在C#中验证文本框的内容 [英] Validating content of a text box in C#

查看:103
本文介绍了在C#中验证文本框的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证文本框?虽然文本框是int类型的空白然后我得到的输入类型格式不正确



标题更新[/编辑]

how to validate text boxes ?while text boxes are blank of int type then i am getting input type is not in correct format

Title updated[/Edit]

推荐答案

demo_reqfieldvalidator [ ^ ]



看到这个......
demo_reqfieldvalidator[^]

see this...


          if ( textbox.Text =="" )
          {
              // then assign ur variable null
          }
          else
          {
              // do your coding
          }

it helps pls select as answer


尝试这个我觉得这就是你需要的............. >




if(textbox1.Text ==){

messagebox.show(你不能离开文本框空白。);

}

else {

//你的代码在这里

}







请接受为答案.......



Reagards,

Ahsan Naveed。
try this I think this is what you need.............


if (textbox1.Text==""){
messagebox.show("You cannot leave the textbox blank.");
}
else {
//your code here
}



please accept as answer.......

Reagards,
Ahsan Naveed.


这篇关于在C#中验证文本框的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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