Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to compare two textbox alphanumeric values with each other in c# WinForm.I want to validate whenever i typed into textbox
Posted
Comments
phil.o 19-Aug-15 6:22am    
This seems like a very trivial task. What have you tried?

1 solution

You can use the TextChanged event[^].
C#
private void yourTextBox_TextChanged(object sender, EventArgs e)
{
    string value1 = textBox1.Text;
    string value2 = textBox2.Text; // change the names here

    // now you can compare value1 and value2 the way you want, for example:
    if (value1 == value2)
    {
        // text is equal
    }
    else
    {
        // text is not equal
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900