Results 1 to 3 of 3

Thread: [RESOLVED] ActiveX Label Caption issue in Runtime

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Resolved [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.

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    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

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    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
  •  



Click Here to Expand Forum to Full Width