<so*************@yahoo.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
I need a help regarding use of a user defined control in VB.NET.
.. . . how to pass the data from the application to the events on the user
control.
You don't pass data /to/ events.
Use properties (Get and Set) to pass data into the UserControl,
then "handle" the events raised /by/ the UserControl back your
"main" application. Over-simplifying this:
Class MyUserControl
. . .
Public Event X_Changed()
. . .
Public Property X() as Integer
Get
Return m_iX
End Get
Set( Value as Integer )
m_iX = Value
RaiseEvent X_Changed
End Set
End Property
Private m_iX as Integer = 0
End Class
Class Form1
Friend WithEvents uc1 as MyUserControl
. . .
Private Sub Button1_Click( _
byVal sender as Object _
, ByVal e as EventArgs _
) Handles uc1.Button1_Click
uc1.X = 99
End Sub
Private Sub uc1_X_Changed( _
byVal sender as Object _
, ByVal e as EventArgs _
) Handles uc1.X_Changed
MsgBox "Something changed X"
End Sub
End Class
HTH,
Phill W.