|
Subject:
|
How to make an ActiveX control
|
|
Posted By:
|
Bajrang
|
Post Date:
|
11/29/2006 5:10:27 AM
|
Hi, i want to make an ActiveX control that is to be inherited from other Controls ( like text box And List Box). I need properties of both controls at design time when i use this ActiveX control in other Application. I created this without inheritence and when i use this control, it shows only forms properties. Textbox and ListBox properties is not shown. I needed both control's properties at design time , How it is possible. Please guide me. thanks in advance
Bajrang
|
|
Reply By:
|
karthiklsimha
|
Reply Date:
|
11/30/2006 1:49:40 AM
|
Hi Bajrang,
You can write some properties in the ActiveX control class and set the property of the contained controls in them.
Example. A ActiveX control has a text box called txt_box then the multiline property can be set by writing the below property in the ActiveX control class. This property will also be visible in the properties window in design time.
Public Property IsMultiLine() As Boolean Get Return txt_Box.Multiline End Get Set(ByVal Value As Boolean) txt_Box.Multiline = Value End Set End Property
Additionaly you can use attributes to set the description text (which is shown in the property window).
Regards, Karthik Simha
|
|
Reply By:
|
Bajrang
|
Reply Date:
|
12/6/2006 12:37:22 AM
|
Thanks for reply. Actually I need properties of both controls at design time when i use this control in other Applications. I thinks its a long process to set/get all properties of both controls. for this I have to findout types of these properties & methods. Is there not any feasiblle methods so I can Just Inherit all properties & methods of these control and add required additional properties & methods . Thanks again, Please reply
Bajrang
|
|
Reply By:
|
karthiklsimha
|
Reply Date:
|
12/7/2006 11:36:41 PM
|
Hi Bajrang,
You can change the access specifiers to public in the control declaration in user control. This will display the child controls itself as property.
For example Change From
Friend WithEvents txt_Box As System.Windows.Forms.TextBox Friend WithEvents btn_Click As System.Windows.Forms.Button
To
Public WithEvents txt_Box As System.Windows.Forms.TextBox Public WithEvents btn_Click As System.Windows.Forms.Button
Then you will be able to set the property as
usercontrol1.txt_Box.MultiLine = True
Regards, Karthik Simha
|