Hi, need your help!
This is a 3-tier application. The business logic layer uses C# function to synch with server, it raises events to notify the UI to report the status of the application. UI is creating a status form in VB.Net.
This is a simple delegate and events function, but when I run the program, I keep receiving error:
Object reference not set to an instance of an object.
Business Logic:
project Synchronization class: clsSynch funtion: Synch()
public delegate void Synch_Status_Delegate(string msg);
public event Synch_Status_Delegate SynStatus;
.......
SynStatus("Start Synch...");
........
UI: In project Main, class clsmain:
Dim frmStatusForm As clsSynchStatus
frmStatusForm.Show();
In Project Main, class clsSynchStatus:
Private WithEvents m_clsSynch As New clsSynch
Public Sub m_clsSynch_SynStatus(ByVal msg As String) Handles m_clsSynch.SynStatus
''put the message in the status bar on the form
Try
Me.lblStatus.Text = msg
Me.Refresh()
Catch ex As Exception
ExceptionManager.Publish(ex)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Synch()
End Sub
Any hints will be appreciated! Let me know if you need further information
Thanks!
This is a 3-tier application. The business logic layer uses C# function to synch with server, it raises events to notify the UI to report the status of the application. UI is creating a status form in VB.Net.
This is a simple delegate and events function, but when I run the program, I keep receiving error:
Object reference not set to an instance of an object.
Business Logic:
project Synchronization class: clsSynch funtion: Synch()
public delegate void Synch_Status_Delegate(string msg);
public event Synch_Status_Delegate SynStatus;
.......
SynStatus("Start Synch...");
........
UI: In project Main, class clsmain:
Dim frmStatusForm As clsSynchStatus
frmStatusForm.Show();
In Project Main, class clsSynchStatus:
Private WithEvents m_clsSynch As New clsSynch
Public Sub m_clsSynch_SynStatus(ByVal msg As String) Handles m_clsSynch.SynStatus
''put the message in the status bar on the form
Try
Me.lblStatus.Text = msg
Me.Refresh()
Catch ex As Exception
ExceptionManager.Publish(ex)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Synch()
End Sub
Any hints will be appreciated! Let me know if you need further information
Thanks!