0

In currently developing a project where I'm going to use a lot of combobox, in order to avoid repeating a lot of code I'm planning on building a user control containing a ComboBox that retrieve the data I need from my tables.

What is the best approach for this since I'm going to use a lot of different ComboBox with different tables ? Differents user controls for differents table or just 1 user control where I pass the table I need ?

Example:

Combo1
 Spring/Summer 2015/2016 
 Spring/Summer 2016/2017 
 Fall/Winter 2015/2016 
 Fall/Winter 2016/2017 
Combo2
 Collection 1 
 Collection 2 
 Collection 3 
 Collection 4 
 Collection 5 

These 2 combo will be repeated a lot of times in the project. My question is : should I create 2 user control (combo1UserControl,combo2UserControl) or just some comboUserControl with some parameteres like the name of the tables ?

asked Jan 28, 2016 at 15:30
1
  • The point of your question is reusing code... if you do 1 UC by table, it looks the same as using the combobox self. But maybe you should explain a bit what your goal is with an example. Commented Jan 28, 2016 at 15:33

1 Answer 1

0

Assuming you are using .NET, mentioning C#, I would look into data binding features first. Most UI toolkit Microsoft has made offer some form of data binding either to objects, object lists or ADO.NET datasets. Mixing your data retrieval with your UI controls is never a good idea, I would try and keep this external to your user interface.

answered Jan 28, 2016 at 21:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.