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: [email protected]
ICQ: 19552879