9
Answers

value validation problem

sachi vasishta

sachi vasishta

15y
3.9k
1

Hi,

I have a winform which contains three text boxes and a button. The textboxes are username,password and confirm password. I have entered the values for the three text boxes and clicked the ok button but it is not properly validating

under button1_click method I have the following code

string uname=textBox1.Text.ToString();

string pass=textBox2.Text.Tostring();

string confirm=textBox3.Text.ToString();

if(pass!=confirm)

MessageBox.Show("Please retype password");

here if I input different values for pass and confirm it is just displaying the message in messagebox but not prompting me back to the textBox3 and also that diffrent values are being inserted into the database. How to avoid this??

 

 

Answers (9)