I found something interesting about form_load event that I could not understand. In my opinion, everything in the form_load will be executed first, however, it is not the case.
When I put
Msgbox("form1_load is being called")
in the first line of Form1_load event, the message box will be popped out.
If I put many staffs before Msgbox method, say, reading from the serial port, initializing checkbox, Msgbox will not be popped out.
The reason this bothers me is because I have initialized my checkbox in the form_load, however, when I tried to access checkbox object in my code somewhere else, the compiler complains that the checkbox object is null. The way I get around it is to initialize checkbox object right before I use (access) it.
What happens behind this? Does it mean Form_load does not guarantee to execute all the code first?
Thanks.