Hej
My event does not react when one value in the property is change.!
Do i have to make a property for each variable?
My event does not react when one value in the property is change.!
Do i have to make a property for each variable?
Public Class Form1 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load AddHandler DataOutChanged, AddressOf _DataOutChanged End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click pDataOut.Mode1 = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click pDataOut.Mode2 = True End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click pDataOut.Mode3 = True End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click pDataOut.Mode4 = True End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click pDataOut.Mode1 = False pDataOut.Mode2 = False pDataOut.Mode3 = False pDataOut.Mode4 = False End Sub Private Sub _DataOutChanged() MsgBox("Data changed" & vbCrLf & pDataOut.Mode1.ToString & vbCrLf & pDataOut.Mode2.ToString & vbCrLf & pDataOut.Mode3.ToString & vbCrLf & pDataOut.Mode4.ToString) End Sub Private Event DataOutChanged() Private DataOut As _DataOut = New _DataOut Public Property pDataOut() As _DataOut Get Return DataOut End Get Set(ByVal value As _DataOut) DataOut = value RaiseEvent DataOutChanged() End Set End Property End Class Public Class _DataOut Public Mode1 As Boolean Public Mode2 As Boolean Public Mode3 As Boolean Public Mode4 As Boolean End Class
Last edited: