|
-
Jul 25th, 2001, 01:08 PM
#1
Thread Starter
Junior Member
defining a defult property for an active-x control
how can i define a defult property to my active-x control?
-
Jul 25th, 2001, 04:54 PM
#2
Lively Member
I assume you are using a private variable to return and set your property ie:
' private variable to hold enabled property
Private mblnEnabled as Boolean
Public Property Get Enabled() As Boolean
' return the private variable
Enabled = mblnEnabled
' do stuff
End Property
Public Property Let Enabled(NewValue As Boolean)
' set the private variable
mblnEnabled = NewValue
' do stuff
End Property
If this is the case then you can use the User Control's InitProperties event To populate your private variable with your default value, that way it will be returned to the user on the first Property Get call, ie:
Private Sub UserControl_InitProperties()
' set my default property value
mblnEnabled = True
End Sub
Hope this is of help.
Best regards,
Rob Brown.
-
Jul 31st, 2001, 08:30 PM
#3
New Member
Another thing you may want to do in your usercontrol is set the default interface property/event. For example for a textbox the default property is .Text and default event is Click().
To set these, go into the code window for your control and select 'Procedure Attributes' from the 'Tools' menu (this is also where you can specify property descriptions and databinding). Select the property you want to make default from the drop down box and click 'Advanced'. From the attributes frame select 'User Interface Default' and set 'Procedure ID' to '(Default)'. You can specify one default property and one default event.
I was caught unaware when:
strTemp = MyTextbox
caused an error in my project using my first ActiveX control because the text property wasn't made default..... by default.
David
Last edited by iamdavid; Jul 31st, 2001 at 08:43 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|