开发者

event sequence in .net windows application

开发者 https://www.devze.com 2023-02-13 15:02 出处:网络
I am new in windows application development. basically i am web developer. but though i want to understand the sequence of events execution in following scenario:

I am new in windows application development. basically i am web developer. but though i want to understand the sequence of events execution in following scenario:

I have win form. it has a button. i am handling开发者_C百科 the button click event. when i get run my application as usually FormLoad event must execute first. but what after i clicks the button ? will form load execute again before button's click event Or form load executes after button click event. Even i can check it my self , but as i tried this i found no sense there as i explained. in fact i wanted to reload my win form on button click with some static parameters (kept in static class). guide me please.


The only thing that happens when you click a button in an application, is the click event is raised, and handled.

Why would a native application re-load the window? Free your mind from this web-type-thinking!

In fact, if you want to re-load the window you should probably have another look at your design, it sounds like it's a bit too web-like. Why are you re-loading the window? If it's just to set some properties, then just set the properties in the click event handler.


  1. First form load_event is fired
  2. After that button_click event will be fired
  3. If you click button only button_click event fired
  4. Whenever you click reload that time form_load fired.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号