shan1
Nov 12th, 1999, 02:56 AM
Please differentiate between activex and usercontrol objects.
I want an example(simple) of using Event(applicable in usercontrols)
Yonatan
Nov 12th, 1999, 03:19 AM
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:
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 (http://www.icq.com/19552879)