How to inherit all control's properties in user control

Makavelli

Member
Joined
Apr 25, 2005
Messages
10
Programming Experience
1-3
I am trying to create a user control with a label and combobox controls and I don't want to have to create all the exposed properties that already exist for the combobox in my control.

My question is this: Is is possible to automatically inherit all the properties for the combobox and the label?

For example, I don't want to have to write this code to show the combobox's SelectedIndex Property but have it show up in the control's property
VB.NET:
Expand Collapse Copy
<System.ComponentModel.Description("Selected Index"), System.ComponentModel.Category("Combobox")> _
Public Property SelectedIndex() as Integer
        Get 
              Return Combobox.SelectedIndex
        End Get
        Set (ByVal value as Integer)
              Combobox.SelectedIndex = value
        End Set
End Property

Thanks
 
The ComboBox in UserControl is declared Friend by default, so you can access it as a property of the usercontrol instance:
VB.NET:
Expand Collapse Copy
UserControl21.ComboBox1.SelectedIndex = 1
 
Back
Top