to herfried

S

Supra

in class1 : i used public event
Public Event onSeverMessage(ByVal szText As String)

then in class 2 i called from class1
Private WithEvents _Connection As New Class1
then i did withevents
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles
_Connection.onSeverMessage
DisplayMessage(nStatus.rtbStatus, szText) <=== this wIll
cause error problem because of szText needed to instantiate object but
i'm not sure
End Sub
now if i replaced szText to " " then i can see all data comming in debug
window this will gave no error problem

then back in class1 then i did raisevents
Select Case C(1).Trim
Case "001" To "014", "251" To "272", "372" To "377",
"401", "422", "462", "468", "503"
Dim intA As Integer = CLi.IndexOf(Nick, 0)
RaiseEvent onSeverMessage(CLi.Substring(intA +
Nick.Length))
\\\
end select

the error is 'An unhandled exception of type
'System.NullReferenceException' occurred in system.windows.forms.dll
'Additional information: Object reference not set to an instance of an
object.
regards,
 
H

Herfried K. Wagner [MVP]

Please don't mention my name in a post's subject. Newsgroup posts are
directed to everybody reading the group.
Public Event onSeverMessage(ByVal szText As String)

then in class 2 i called from class1
Private WithEvents _Connection As New Class1
then i did withevents
Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles
_Connection.onSeverMessage
DisplayMessage(nStatus.rtbStatus, szText) <=== this wIll cause
error problem because of szText needed to instantiate object but i'm not
sure
End Sub
now if i replaced szText to " " then i can see all data comming in debug
window this will gave no error problem

Post the implementation of 'DisplayMessage' and the /complete/ error
message.
 
M

Mythran

Herfried K. Wagner said:
Please don't mention my name in a post's subject. Newsgroup posts are
directed to everybody reading the group.

Oh, you know you like it! :p

Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top