Customizing ComboBox

  • Thread starter Thread starter Jose Fernandez
  • Start date Start date
J

Jose Fernandez

Hey...
How are you doing?

Ok, New Year's troubles...

I am trying to create a custom ComboBox (inheriting from ComboBox object).

Well, my whole goal is simple. I want to add some Properties, so, in Design
Time, i specify from wich entity i am gonna populate my Dropdown (using
Reflection and invoking a method to retrieve an arraylist with the values).

But, i have to admit i am getting lost on my way to achieve it.

I haven't been able to find a good article in google. I came to this forum.
I need help

thanks in advance
Jose
 
Jose,

You didn't give enough information in order to give you more concreted
advice, but can't you just use standard databinding for that?
 
OK.

what i want is that when i drag the CustomcomboBox to the form, then i
specify in the properties windows the name of the Entity (custom Object...
Employee for example).
So, using reflection, i invoke the Employee object, and then its methods
LoadCombo. This method returns an arraylist with the ID and FullName of the
Employee.

Ok, I want to create one and only customComboBox for this. Cause every
entity is going to have a LoadCombo method that will populate a Combo (by
returning an arraylist). So, very easy would be just to drag the
customcombobox to the form, write in the property window the entity name and
voila, when press F5 you should see the combo populated with the values.
 
As long as every object that is associated with a ComboBox has a property
that can be DataBound to the ComboBox, you shouldn't need to do this at all.
Just use normal DataBinding.

--
HTH,

Kevin Spencer
Microsoft MVP
Bit Player
http://unclechutney.blogspot.com

Where there's a Will, there's a William.
 
I agree with Kevin. Take a look at the databinding feature. At the very this
is what databinding is all about.
 
Back
Top