Allow only integers in TextBoxes

后端 未结 6 1371
情书的邮戳
情书的邮戳 2021-01-22 12:45

I\'m having a problem with checking textboxes and making sure there\'s only integers in them.

So far I\'m able to confirm that there\'s text in the textboxes, but checki

6条回答
  •  滥情空心
    2021-01-22 13:36

    Override the Validating event in your form's textboxes and then you can do a TryParse on the contents.

    public void textBox1_Validating(...)
    {
      // TryParse
    }
    

提交回复
热议问题