Help with Inherited Control

  • Thread starter Thread starter Poohface
  • Start date Start date
P

Poohface

I'm trying to create a list box control that replaces the itemData
property that we had in VB6. I created and inherited control from the
listbox class and was able to add a data property, now the problem is,
that property get applied to the listbox as a whole. So it would seem
I actually have to make an inherited control out of the ListControl
class so that each item in the listbox can have this property. This is
where I get a lil messed up. Am I correct in stating that I would have
to do the following:

1) Create a inherited control out of the ListControl class that
creates a propertie for the items to hold a ItemData property. (need
help on doing that)

2) Create a Inherited ListBox control that makes use of the above
mentioned control to override the default ListControl that in makes
use of. (how to do that?)

Please let me know if I'm on the right track. Please don't just point
me to some exsisting control that does this. I wish to learn how to do
this as it will come in handy for future modifications I need to make
to the control.

Thank you for any help. I've bought some books but this subject in not
covered well.

Norst
 
Poohface,

The listcontrol (and especially the combobox) has already so many data
properties (in my opinion the reason that not everything is working always
in that way as most of us the first time expect that it should work).

What dataproperties do you want to add to that.

Cor
 
Well after some reading I've altered my approach a bit. I've created a
class that will be the items in my list box, since I realize now that
the new listbox in .Net can hold objects and not just a test and a
itemdata. This way they can hold as much data as I like. One thing I
would really love to add to the listbox control though is the ability
to alter the background color of any given item in the list.

Norst
 
Poohface,
Well after some reading I've altered my approach a bit. I've created a
class that will be the items in my list box, since I realize now that
the new listbox in .Net can hold objects and not just a test and a
itemdata.

That would have been at the end the approach that I would probably have
advised you.

:-)

Cor
 
Yeah the only thing that threw me at 1st was the display of the object
in the listbox. But the override of the .tostring function is a pretty
slick trick. I'm really starting to get impressed with the whole .Net
deal right now. Just need to convince a few more in the company. I'm
hope'n this project will help :o)

Norst
 
Back
Top