文字框(如果有) [英] TextBox (if then)

查看:85
本文介绍了文字框(如果有)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

txtyear1是一个文本框,其值为2010
txtyear2是一个文本框,其值为2011

txtyear1 is a textbox that has the value of 2010
txtyear2 is a textbox that has the value of 2011

if (txtyear2.Text >= txtyear1.Text)


推荐答案

一个例子:

One example:

if (Int16.Parse(txtyear2.Text) >= Int16.Parse(txtyear1.Text))
{
}



您还应该查看Int16.TryParseConvert.ToInt16



you should also check out Int16.TryParse or Convert.ToInt16


尝试一下,
Try this,
if (Convert.ToInt32(txtyear2.Text) >= Convert.ToInt32(txtyear1.Text))
{
}


尝试一下

try this

if (Convert.ToInt32(txtyear2.Text) >= Convert.ToInt32(txtyear1.Text))


这篇关于文字框(如果有)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆