I need some help with textboxes, I have a textbox that I need to test if it contains numbers only, I know I can use a masked textbox but it just do’s not fit my use, I have some of the code I need which you can see below here, the part I need is in the second line.
Language: C#
Platform: WinXP
Programming software: VS2005
Type: Windows Forms
Expand|Select|Wrap|Line Numbers
- if (textBoxAddBook_Year.Text.Length == 4)
- if (textBoxAddBook_Year.Text == Missing!!!)
- if (Convert.ToInt32(textBoxAddBook_Year.Text) >= 1600)
- if (Convert.ToInt32(textBoxAddBook_Year.Text) <= DateTime.Now.Year)
- { varYearOK = true; }
As you can see I need to check if the text in the textbox is numbers only before I check if the year is correct.
NormannTheDane