Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deletage and Events:Object reference not set to an instance of an obje

Status
Not open for further replies.

uticket

IS-IT--Management
Jun 1, 2004
37
US

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!




 
The error was on this line of code when the business object raises events:

SynStatus("Start Synch...");

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top