Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Form_Load event method

Tags:

c#

winforms

In C#, what is Form_Load event method?

like image 927
Bob McBobberson Avatar asked Mar 13 '11 19:03

Bob McBobberson


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is C in C language?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

Is C language easy?

Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.


1 Answers

It is just a method name, its actual name doesn't have any significance. You'd typically use a method with a name like that to listen for the Load event of the Form class. The Winforms designer auto-generates it when you use the lightning bolt icon in the Properties window or when you double-click the form in the designer. The name is more typically Form1_Load. But do make it a practice to give the form a good Name first. Like MainWindow.

The Load event fires just before the window becomes visible. It is useful because at that point the real window size and location is accurate, you might want to use it to move or size controls. Or anything else where the window size and location matters.

Implementing the Load event for a Form is an anachronism that dates back to the VB6 days. Events are meant to let code in other classes know what's happening. The Winforms way is to override the OnLoad() method instead. The designer favors the VB6 way though. It isn't terribly wrong when you don't derive from the form.

like image 193
Hans Passant Avatar answered Oct 12 '22 15:10

Hans Passant