?
Solved

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

Posted on 2007-10-17
6
Medium Priority
?
205 Views
Last Modified: 2010-04-15
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?
0
Comment
Question by:freename
  • 3
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20095346
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
0
 
LVL 7

Expert Comment

by:Gewgala
ID: 20095712
Yeah, if it's simplicity that you're going for just put it in the codebehind.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20095765
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:Gewgala
ID: 20095913
That's true, lol, didn't even check.  I assumed.  You know what happens when we assume...
0
 

Author Comment

by:freename
ID: 20102807
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.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 375 total points
ID: 20102846
It is difficult to say what is the "best practice", but the "preferred method" for me is to do that in the Form_Load, but sometimes there is a lot of overhead to initializing all the controls on a multi-page TabControl, so it can be better accomplished in the Selecting event handler.

Bob
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question