|
-
Feb 8th, 2010, 05:13 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] ActiveX Label Caption issue in Runtime
Dears,
I have created an ActiveX control. I placed a picture box and a lable in it with the following code
Code:
Event resizeMe()
Private Sub UserControl_Resize()
On Error Resume Next
P1.Move 0, 0, UserControl.Width - 10, UserControl.Height - 10
L1.Move 0, (UserControl.Height / 2) - (L1.Height / 2), UserControl.Width, 255
RaiseEvent resizeMe
End Sub
'declare object properties
Public Property Get Caption() As String
Caption = L1.Caption 'return button caption
End Property
Public Property Let Caption(ByVal newCap As String)
L1.Caption = newCap 'set button caption
End Property
Public Property Get BackColor() As OLE_COLOR
BackColor = UserControl.BackColor 'return bgcolor
BackColor = L1.BackColor
End Property
Public Property Let BackColor(ByVal newBack As OLE_COLOR)
UserControl.BackColor() = newBack 'set bgcolor
L1.BackColor() = newBack
End Property
I placed that ActiveX control on form and set it caption. But when run the project, it caption changed to none (mean no caption)... please help
Last edited by hafizfarooq; Feb 8th, 2010 at 05:42 AM.
-
Feb 8th, 2010, 08:26 AM
#2
Re: ActiveX Label Caption issue in Runtime
Use the UC's Read/Write Properties to perist the label's caption.
Something like this
Code:
Public Property Get Caption() As String
Caption = Label1.Caption
End Property
Public Property Let Caption(ByVal New_Caption As String)
Label1.Caption() = New_Caption
PropertyChanged "Caption"
End Property
'******************called at run time**************
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Label1.Caption = PropBag.ReadProperty("Caption", "Label1")
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Caption", Label1.Caption, "Label1")
End Sub
-
Feb 8th, 2010, 10:07 PM
#3
Thread Starter
Fanatic Member
Re: ActiveX Label Caption issue in Runtime
Thanks VBClassicRocks,
I will try it and let u know
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
|