control changed

There are several controls on the windows form (i.e. textboxes, datetimepicker, etc...)
on clicking a button such as Apply button, how can I find out if the user has changed the values in the controls
Thanks


Answer this question

control changed

  • Jim Danger

    Do you have the DropDownStyle set to DropDownList Is so, check the SelectedIndexChanged event. The TextChanged event fires fine for me when the DropDownStyle is set to DropDown.

  • Dave Wickert

    this event does not get called when the combobox is changed. do you know why
    private void statusComboBox_TextChanged(object sender, System.EventArgs e)

    {

    valueChanged = true;

    }
    thanks


  • S.Mark

    Hi,

    You have several ways of doing this. There isn't a instant kind of solution for this. First you could get all the values by default either in your form load or after you've populated your controls. And check if the values remain the same when the user clicks the button. Or you could validate each control, so that when the user leaves a textbox you check if its been modified. Lastly, if your connected to a database, then you could just bind all of your controls. Then check the datatable if some changes occured dataTable.HasChanges()...

     

     

    cheers,

    Paul June A. Domag



  • TrackerX

     fmardani wrote:

    this event does not get called when the combobox is changed. do you know why
    private void statusComboBox_TextChanged(object sender, System.EventArgs e)

    {

    valueChanged = true;

    }
    thanks

    The text changed event fires when you change the text in your combobox by typing on it. But as the last post suggested, if you set the style of your combo into DropdownList, the event wont fire. The event that you should handle if you want to check if a user changed something is the selectedindex changed event...

     

    cheers,

    Paul June A. Domag



  • control changed