Perhaps this is too simple of an answer, but is your
problem that you don't want the event to fire the first
time the form loads up? You can do that by checking for
ISPostBack:
void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
stuff you only want to do each time the form
is submitted;
...
}
else
{
Do the stuff you want to do when the page initially
loads...
...
)
}
You can also do the reverse... check for (!IsPostBack) if
you have code you only want to execute when the page
initially loads.
(again, I'm not sure if this is what you are asking for or
not...)
-----Original Message-----
I've got a combo box that has an event handler set for
SelectedIndexChanged event. The problem is that it's
firing at startup when I load data from the Form_OnLoad
event. I tried setting a flag at startup and turning it
off at the end of the OnLoad function but the
SelectedIndexChange event gets called after OnLoad
finishes, so my flag is off. How can I get around this?
Is there another event that I can use to turn the flag
off? Or assign my SelectedIndexChanged event handler
thereinstead of InitializeComponent?
.