Hello! I need some help about a problem that I have with my own properties in an ActiveX control.
These are my steps...
1 - I create a new ControlActiveX project, COwnControl.vbp is called. I create a new ctl file (C1.ctl)
This is the code of the ctl file:
Private myprop As Long
Public Property Let MyProperty(ByVal oMP As Long)
myprop = oMP
PropertyChanged "MyProperty"
End Property
Public Property Get MyProperty() As Long
MyProperty = myprop
End Property
2 - I generate the COwnControl.ocx file.
3 - I register the file. The registation goes successful
4 - I create a new project (EXE standar project). It has a form. I generate this code in the Load event of the form:
Private Sub Form_Load()
Set obj = Me.Controls.Add("COwnControl.C1", "ctrl"
obj.MyProperty = 1
End Sub
And when I run the application, I recive the 438 error message (The object not support the "MyProperty" property...)
I know that the MyProperty property is accessible from obj.Object (object), but if I add the control in dessign time, I don't have this error and I can access to this property as obj.MyProperty and not obj.Object.MyProperty like when I add the control in runtime.
What is happening? What can I do not to write obj.Object.MyProperty when I want to change this property, and just write obj.MyProperty?
Very thanks!!!
These are my steps...
1 - I create a new ControlActiveX project, COwnControl.vbp is called. I create a new ctl file (C1.ctl)
This is the code of the ctl file:
Private myprop As Long
Public Property Let MyProperty(ByVal oMP As Long)
myprop = oMP
PropertyChanged "MyProperty"
End Property
Public Property Get MyProperty() As Long
MyProperty = myprop
End Property
2 - I generate the COwnControl.ocx file.
3 - I register the file. The registation goes successful
4 - I create a new project (EXE standar project). It has a form. I generate this code in the Load event of the form:
Private Sub Form_Load()
Set obj = Me.Controls.Add("COwnControl.C1", "ctrl"
obj.MyProperty = 1
End Sub
And when I run the application, I recive the 438 error message (The object not support the "MyProperty" property...)
I know that the MyProperty property is accessible from obj.Object (object), but if I add the control in dessign time, I don't have this error and I can access to this property as obj.MyProperty and not obj.Object.MyProperty like when I add the control in runtime.
What is happening? What can I do not to write obj.Object.MyProperty when I want to change this property, and just write obj.MyProperty?
Very thanks!!!