Results 1 to 2 of 2

Thread: USer controls...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    21

    Post

    Please differentiate between activex and usercontrol objects.
    I want an example(simple) of using Event(applicable in usercontrols)

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Post

    There is no difference between ActiveX controls and UserControls... Except the ActiveX control is a compiled UserControl in an OCX file, while the UserControl is in your project.

    Here's a quick sample:

    Code:
    Option Explicit
    
    
    Event TextChanged()
    
    
    Private m_sText As String
    
    
    Private Sub PrintText()
        Call Cls
        Print m_sText
        RaiseEvent TextChanged
    End Sub
    
    
    Private Sub UserControl_Initialize()
        AutoRedraw = True
        Call PrintText
    End Sub
    
    
    Private Sub UserControl_InitProperties()
        m_sText = "Text1" ' Default Property
        Call PrintText
    End Sub
    
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        m_sText = PropBag.ReadProperty("Text", "Text1")
        Call PrintText
    End Sub
    
    
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        Call PropBag.WriteProperty("Text", m_sText, "Text1")
    End Sub
    
    
    Public Property Get Text() As String
        Text = m_sText
    End Property
    
    
    Public Property Let Text(ByVal sNewText As String)
        m_sText = sNewText
        Call PrintText
        Call PropertyChanged("Text")
    End Property
    ------------------
    Yonatan
    Teenage Programmer
    E-Mail: RZvika@netvision.net.il
    ICQ: 19552879



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