Link to home
Start Free TrialLog in
Avatar of freename
freenameFlag for United States of America

asked on

Design question - What event to use for updating comboboxes on multitab tabcontrol

This is simply a design question. I'm seeking advice. I have a single windows form with a tabcontrol containing two tabpages. The tabpages have an assortment of controls including comboboxes. Design and performance wise, where is the best place to put the code that binds the comboboxes to their respective datasources?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

I am big fan of a data access layer class that provides all interfaces to the database.  If you want to get fancy, you could get involved with application frameworks, like CSLA or NHibernate.  If you want to keep it simple, it could be a class with a couple of methods to get the data that you need, and to write changes back to the database.

Bob
Yeah, if it's simplicity that you're going for just put it in the codebehind.
Well, we haven't even about application type, so we can't assume that there is going to be a web page with a code-behind.

Bob
That's true, lol, didn't even check.  I assumed.  You know what happens when we assume...
Avatar of freename

ASKER

Thanks for the replies. This is a Windows Form, so there is now codebehind. I also use a DataAccessLayer class to do the the Database work and the form is just to display the collection of data to the user. Therefore, my question was, when I go to display some of this data in ComboBoxes, where is the best place to do it; form_load event, tabpage_layout or some other. I'm doing some in the load event, the stuff that needs to be displayed immediately and some in the layout event for the tabpage. I just want to know if there is a "Best Practice" for this.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial