Search code examples
c#textboxtextchanged

TextChanged event doesn't work.


I have a textbox in Form and i want to detect when the text has changed but the code I have found is giving me no joy.

I am probably missing something in the proporties or something you have to define before.

Here is my code:

private void tbxparkingTimesS1_TextChanged(Object sender, EventArgs e)
{
     MessageBox.Show("You are in the ToolStripItem.TextChanged event.");
}

Thanks for any help with this trivial problem.


Solution

  • To wire the TextChanged event to a particular method inside your code do the following

    • Click on the TextBox inside your form
    • Open the properties windows (press F4 or menu View -> Property Window )
    • Select the event page (lightning icon)
    • Double click on the TextChanged property line
    • Insert your code inside the template build for you by Visual Studio