hie all

i have two text boxes , password and confirm password now what i am trying to do is when password match a label near confirm passwd text box turns green automatically and say match and if not match its should turn red and say not match , and it should before pressing any button

private void button1_Click(object sender, EventArgs e)
        {
            if (TextBox.Equals(textBox1.Text, textBox2.Text))
            {
                label4.Visible = true;
                label4.Text = "password match";

            }
            else
            {

                label4.Visible = true;
                label4.Text = " not matched";
                textBox1.Focus();
            }
        }

this is my code so far now, it gives me no error but when i press enter then only it compares and gives me the match or not match results in label , i want to do it before pressing this buttion automatically

is it possible

please any suggestion

Regards and advance thankx

put the validation code in the OnTextChanged event

Use the Text changed event for Textbox2.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.