Where am i going wrong??? ActiveX Control 
Author Message
 Where am i going wrong??? ActiveX Control

I have created an ActiveX control. It has one text box on it. Here is the
code

Private Sub UserControl_InitProperties()
    Caption = Text1.Text
End Sub

Public Property Get Caption() As Variant
    Caption = Text1.Text
End Property

Public Property Let Caption(ByVal vNewValue As Variant)
    Text1.Text = vNewValue
    PropertyChanged "Caption"
End Property

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    PropBag.WriteProperty "Caption", Caption
End Sub

I have inserted the control into my project.

When i set a new "Caption" at design time in my project the value is updated
on the form - HOWEVER when I run the project the text box reverts to Text1 -
i.e. the text box's default!

Can any one help

Thanks in advance

Shandy



Tue, 04 May 2004 22:50:17 GMT  
 Where am i going wrong??? ActiveX Control
Missing "UserControl_ReadProperties"... The code below works fine...
'===============
Option Explicit

Public Property Get Caption() As String
   Caption = Text1.Text
End Property

Public Property Let Caption(ByVal New_Caption As String)
   Text1.Text = New_Caption
   PropertyChanged "Caption"
End Property

Private Sub UserControl_InitProperties()
   Text1.Text = ""
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
   Text1.Text = PropBag.ReadProperty("Caption", "")
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
   Call PropBag.WriteProperty("Caption", Text1.Text, "")
End Sub
'===============

--
Ken Halter
MS-MVP-VB
http://www.vbsight.com
Please respond only to the newsgroups so all can benefit.
Besides.. I check my email only once a week :-)


Quote:
> I have created an ActiveX control. It has one text box on it. Here is the
> code

> Private Sub UserControl_InitProperties()
>     Caption = Text1.Text
> End Sub

> Public Property Get Caption() As Variant
>     Caption = Text1.Text
> End Property

> Public Property Let Caption(ByVal vNewValue As Variant)
>     Text1.Text = vNewValue
>     PropertyChanged "Caption"
> End Property

> Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
>     PropBag.WriteProperty "Caption", Caption
> End Sub

> I have inserted the control into my project.

> When i set a new "Caption" at design time in my project the value is
updated
> on the form - HOWEVER when I run the project the text box reverts to
Text1 -
> i.e. the text box's default!

> Can any one help

> Thanks in advance

> Shandy



Tue, 04 May 2004 23:08:15 GMT  
 Where am i going wrong??? ActiveX Control
Thank you Thank you Thank you!


Quote:
> Missing "UserControl_ReadProperties"... The code below works fine...
> '===============
> Option Explicit

> Public Property Get Caption() As String
>    Caption = Text1.Text
> End Property

> Public Property Let Caption(ByVal New_Caption As String)
>    Text1.Text = New_Caption
>    PropertyChanged "Caption"
> End Property

> Private Sub UserControl_InitProperties()
>    Text1.Text = ""
> End Sub

> Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
>    Text1.Text = PropBag.ReadProperty("Caption", "")
> End Sub

> Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
>    Call PropBag.WriteProperty("Caption", Text1.Text, "")
> End Sub
> '===============

> --
> Ken Halter
> MS-MVP-VB
> http://www.vbsight.com
> Please respond only to the newsgroups so all can benefit.
> Besides.. I check my email only once a week :-)



> > I have created an ActiveX control. It has one text box on it. Here is
the
> > code

> > Private Sub UserControl_InitProperties()
> >     Caption = Text1.Text
> > End Sub

> > Public Property Get Caption() As Variant
> >     Caption = Text1.Text
> > End Property

> > Public Property Let Caption(ByVal vNewValue As Variant)
> >     Text1.Text = vNewValue
> >     PropertyChanged "Caption"
> > End Property

> > Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
> >     PropBag.WriteProperty "Caption", Caption
> > End Sub

> > I have inserted the control into my project.

> > When i set a new "Caption" at design time in my project the value is
> updated
> > on the form - HOWEVER when I run the project the text box reverts to
> Text1 -
> > i.e. the text box's default!

> > Can any one help

> > Thanks in advance

> > Shandy



Tue, 04 May 2004 23:17:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Where am I going wrong ??!!

2. ado-commands -where am I going wrong ?

3. help? where am i going wrong

4. VBA code to go to a bookmarked drop down goes to wrong drop down

5. ADO Data Control - What Am I Doing Wrong?

6. Will somebody tell me what I am doing wrong with this ListView Control

7. Referring to controls - What am I doing wrong???

8. Referring to controls - What am I doing wrong???

9. ActiveX Control Interface Wizard, Where do Descriptions Go?

10. I am trying to update a record, i am not using data control

11. ** HELP WITH vb 4.0 I am going crazy**

12. Am I going insane...?

 

 
Powered by phpBB® Forum Software