fhnaylor
fhnaylor

Reputation: 45

Why is the form_load event is not called in my Winforms application?

I don´t know why, but my form isn´t calling Form_Load event when it loads.

Any ideas why this might be happening?

Upvotes: 1

Views: 3440

Answers (3)

Matthew Lock
Matthew Lock

Reputation: 13486

Perhaps an exception is being thrown in Initialize_Component(); which prevents the on load method being called?

http://blog.paulbetts.org/index.php/2010/07/20/the-case-of-the-disappearing-onload-exception-user-mode-callback-exceptions-in-x64/

Upvotes: 1

littlecodefarmer758
littlecodefarmer758

Reputation: 966

go to the btnSave find "Click" set "btnSave_Click" then works

Upvotes: 0

itsmatt
itsmatt

Reputation: 31406

Do you have the event handler set up?

Ultimately, there is going to be a line of code that looks something like this:

this.Load += new System.EventHandler(this.Form1_Load);

That might be something you code yourself, or is generated by double-clicking the Load event for the form from within Visual Studio.

Upvotes: 6

Related Questions