Windows forms - Open event

  • Thread starter Thread starter Paul Sampson
  • Start date Start date
P

Paul Sampson

There is probably a simple answer to this one. I've come from a VB6
background, where I've used the Open event on a form to load data
structures, bind controls, etc.

Unless I'm overlooking the obvious, I can't see how/where this is done in
C#. I have this line inside main() :

Application.Run(new frmMain());



Can anyone tell me the ideal place to make connections to SQL and bind
controls using strong typing (that's the end goal).

Any good links would be appreciated too.

Many thanks
 
Paul Sampson said:
There is probably a simple answer to this one. I've come from a VB6
background, where I've used the Open event on a form to load data
structures, bind controls, etc.

Unless I'm overlooking the obvious, I can't see how/where this is done in
C#. I have this line inside main() :

Application.Run(new frmMain());



Can anyone tell me the ideal place to make connections to SQL and bind
controls using strong typing (that's the end goal).

Assuming a simple situation, you would ideally override the OnLoad method of
the frmMain class. The OnLoad method is called when the form is loaded,
allowing you to handle such setup.
 
Back
Top