Where to call database?

  • Thread starter Thread starter John
  • Start date Start date
J

John

Where is the proper place to make database calls for
initial data the form needs for display?

In the constructor or in the Form_Load event? Or
somewhere else?

Thanks,
John
 
* "John said:
Where is the proper place to make database calls for
initial data the form needs for display?

In the constructor or in the Form_Load event? Or
somewhere else?

It doesn't matter if you do it in the ctor or the 'Load' event handler.
Notice that prior to the call to 'InitializeComponent' controls are not
already constructed.
 
Is there a best practice guideline on this?

Do you alternate? Or do you have a favorite?

John
 
* "John said:
Is there a best practice guideline on this?

Do you alternate? Or do you have a favorite?

I often use the 'Load' event handler or 'OnLooad', but only because I am
used to that from VB6. I would prefer adding the code after the call to
'InitializeComponent' in the ctor.
 
Back
Top