winform应用程序中的验证 [英] validations in winform application

查看:114
本文介绍了winform应用程序中的验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的应用程序有10个文本框和10个按钮,



每个文本框一键。

在文本框中输入数据按下按钮。



如此验证文本框。如何操作



以前的应用程序我写了验证,验证事件,在那个应用程序只有一个按钮,所以它工作,



但现在当我进入第一个文本框中的数据单击相应的按钮,然后其他文本框不满足条件,因此他们给出错误。



如何解决它。

Hi,

My application is having 10 textboxes and 10 buttons,

for each textbox one button.
enter the data in textbox press button .

so validate that textbox .how to do

in previous application i wrote validate, validating events ,in that appl only one button so it worked,

but now when i enter data in first textbox click corresponding button , then other textboxes r not satisfying the condition so they r giving error.

how to solve it.

推荐答案

检查以下问题的答案



http://stackoverflow.com/questions/11109118/c-sharp-validating-multiple-textboxes [ ^ ]







http://www.c-sharpcorner.com/UploadFile/DipalChoksi/UsingErrorProviderContolinWindowsFormsandCSharp11242005010829AM/UsingErrorProviderContolinWindowsFormsandCSharp.aspx [ ^ ]



http://www.c-sharpcorner.com/UploadFile/scottlysle/UseErrorProvider03082007210138PM/UseErrorProvider.aspx [ ^ ]
check answers of below question

http://stackoverflow.com/questions/11109118/c-sharp-validating-multiple-textboxes[^]

and

http://www.c-sharpcorner.com/UploadFile/DipalChoksi/UsingErrorProviderContolinWindowsFormsandCSharp11242005010829AM/UsingErrorProviderContolinWindowsFormsandCSharp.aspx[^]

http://www.c-sharpcorner.com/UploadFile/scottlysle/UseErrorProvider03082007210138PM/UseErrorProvider.aspx[^]


BY KEEPING if -else in button click event
BY KEEPING if -else in button click event


只验证文本框用这样的相对按钮.. :)



just validate textbox with relative button like this.. :)

public void btnSave_Click(object sender,EventArgs e)
  {

      if (txtNumber.Text != "" || txtNumber.Text != string.Empty)
      {


      }
      else
      {

          MessagBox.Show("Please enter Number...!!! ");
      }

  }


这篇关于winform应用程序中的验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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