Hi,
I have a winform that contains the following
4 textboxes and a button.
a)first name b)ssn c)lastname d)city e)zip
here if the user doesnot enter the values for first name and/or last name then it should give a message saying please enter the first name and/or last name . And the zip field's value is 5 characters so if the user enters lessthan or morethan 5 characters then again it should give a message saying zip values is too short or too long.
Vimal KandasamyPosted Apr 8, 2009, 9:36 AM
In a button click event
you simply check like
firstname.Text.Lengh<1
or firstname.Text==""
[firstname refers Textbox]...
for zip
if(zip.Text.Length==5))
{
//add you code
}
else
MessageBox.Show("zip must be 5 chars","Error");
[zip refers Textbox]
you can combine these conditions with the help of && operator
try it..