Form Load vs Activated Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I thought that the Load Event fired first and the Activated event fired next
when a control is shown. For example

Dim myForm as New Form1

myForm.Show

I put a breakpoint in the load event and one in the activated event and the
activated event fires first. I am trying to implement adding an event
handler in the load event for the activated event then removing the handler
in the activated event such that the activated event only fires once.

Am I wrong in the event firing sequences?
 
Dennis,

Am I wrong in the event firing sequences?
There are different sequences for different situations.

There is a page on MSDN which describes it, however it is for me as some
other obvious pages as about the methods in the microsoft namespace almost
impossible to find direct. Maybe can you try it yourself.

Cor
 
Dennis said:
I thought that the Load Event fired first and the Activated event fired
next
when a control is shown. For example

Dim myForm as New Form1

myForm.Show

I put a breakpoint in the load event and one in the activated event and
the
activated event fires first. I am trying to implement adding an event
handler in the load event for the activated event then removing the
handler
in the activated event such that the activated event only fires once.

You may want to add the handler in the form's constructor after the call to
'InitializeComponent'.
 
I could do that but I want to initialize some things in the Activated method
like setting a combobox.selectedindex to a value but I get an error because
the load event hasn't executed, the combobox is unavailable.
 
Back
Top