tags:

views:

35

answers:

1

So I have a windows forms application and I have a drop down that is bound to a dataset. Upon load I want to bind the control to the database value. I have some validation that takes place but I only want this to occur after the form has loaded and the user changes a value in the drop down. Currently I have the code in a _SelectedIndexChanged event. This gets fired when the control is also bound to the database value.

I know in asp.net I can say (!Page.IsPostBacK) to control whether or not it should fire the code. What is the windows forms paradigm?

Thanks!

+1  A: 

Hi there.

Easiest way would be to have a bool variable on your form set to false. Inside the SelectedIndexChanged event, set the variable to true. When your validation code executes, have it check that value of the bool variable to determine whether the validation should be performed.

Cheers. Jas.

Jason Evans