Additional information: Object reference not set to an instance ofan object................

S

Supra

I am doing irc chat similar to mirc chat if i connected to
irc.webamster.com i had no problem. but if connected to eu.undernet.org.
i got error....somthing bug me! O:)
'February 2004
'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.


Option Explicit On
Option Strict Off

Imports System
Imports System.Text

'Imports System.Net.Dns
'Imports System.Net.Sockets

Namespace PirateChat

Public Class mainPirateChat <============ error occurred here in bold
Inherits System.Windows.Forms.Form

Private WithEvents netBots As New PirateChat.ClientFactory
Private WithEvents Netsock As New PirateChat.SockFactory
Private clsReader As New PirateChat.clsReadWriteXML

Private Sub mnuWindowCascade_Click_1(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
mnuWindowCascade.Click, mnuWindowTitleH.Click, mnuWindowTitleV.Click,
mnuWindowArrange.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "&Cascade"
Me.LayoutMdi(MdiLayout.Cascade)
Case "Title Horizontal"
Me.LayoutMdi(MdiLayout.TileHorizontal)
Case "Title &Vertical"
Me.LayoutMdi(MdiLayout.TileVertical)
Case "&Arrange Icons"
Me.LayoutMdi(MdiLayout.ArrangeIcons)

End Select
End Sub

Private Sub mnuIrc_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuIrcConnect.Click, mnuIrcPref.Click,
mnuIrcExit.Click

Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Connect"
netBots.ConnectServer()
Case "Preferences..."
Dim frmPref As New PirateChat.frmPreferences
frmPref.MdiParent = Me
frmPref.Show()
Case "Exit"
Me.Close()
End Select
End Sub

Private Sub mnuServer_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles mnuSerAdm.Click, mnuSerMotd.Click,
mnuSerInfo.Click, _
mnuSerMap.Click, mnuSerLink.Click, mnuSerVer.Click,
mnuSerCom.Click, mnuSerTime.Click, mnuSerLoAU.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Admin Info"
Netsock.SendData(Netsock.StringToBytes("admin" &
vbCrLf))
Case "MOTD"
Netsock.SendData(Netsock.StringToBytes("motd" & vbCrLf))
Case "Server Info"
Netsock.SendData(Netsock.StringToBytes("server" &
vbCrLf))
Case "Map Info"
Netsock.SendData(Netsock.StringToBytes("map" & vbCrLf))
Case "Link Info"
Netsock.SendData(Netsock.StringToBytes("links" &
vbCrLf))
Case "Server's Commands"

Case "Server's Time"
Netsock.SendData(Netsock.StringToBytes("time" & vbCrLf))
Case "Server's Version"
Netsock.SendData(Netsock.StringToBytes("version" &
vbCrLf))

Case "List of All Users"
End Select
End Sub

Private Sub mnuInfo_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuInfoAlias.Click, mnuInfoStart.Click,
mnuInfoChan.Click, _
mnuInfoNot.Click, mnuInfoserInf.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Aliases..."
mnuFrmHandling(mi.Text)
Case "Startup..."
mnuFrmHandling(mi.Text)
Case "Channels..."
mnuFrmHandling(mi.Text)
Case "Notify lists..."
Dim nlform As New frmNotifyLists
nlform.MdiParent = Me
nlform.Show()
Case "Server's status"

netBots.nStatus.MdiParent = Me
netBots.nStatus.Show()
End Select
End Sub

Private Sub mnuFrmHandling(ByVal frmName As String)

For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next

Dim frmNew As frmAlias
frmNew = New frmAlias
frmNew.MdiParent = Me
frmNew.Name = frmName

Select Case frmName
Case "Aliases..."
frmNew.Text = frmName

Case "Startup..."
frmNew.Text = frmName

Case "Channels..."
frmNew.Text = frmName
End Select
frmNew.Show()
End Sub

End Class
End Namespace
 
N

Nick Malik [Microsoft]

you have no try catch statements. Therefore, you cannot see where the
actual error is occurring.

Please use error handling to narrow down the location of your error.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
I am doing irc chat similar to mirc chat if i connected to irc.webamster.com
i had no problem. but if connected to eu.undernet.org. i got
error....somthing bug me! O:)
'February 2004
'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.


Option Explicit On
Option Strict Off

Imports System
Imports System.Text

'Imports System.Net.Dns
'Imports System.Net.Sockets

Namespace PirateChat

Public Class mainPirateChat <============ error occurred here in bold
Inherits System.Windows.Forms.Form

Private WithEvents netBots As New PirateChat.ClientFactory
Private WithEvents Netsock As New PirateChat.SockFactory
Private clsReader As New PirateChat.clsReadWriteXML

Private Sub mnuWindowCascade_Click_1(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuWindowCascade.Click,
mnuWindowTitleH.Click, mnuWindowTitleV.Click, mnuWindowArrange.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "&Cascade"
Me.LayoutMdi(MdiLayout.Cascade)
Case "Title Horizontal"
Me.LayoutMdi(MdiLayout.TileHorizontal)
Case "Title &Vertical"
Me.LayoutMdi(MdiLayout.TileVertical)
Case "&Arrange Icons"
Me.LayoutMdi(MdiLayout.ArrangeIcons)

End Select
End Sub

Private Sub mnuIrc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuIrcConnect.Click, mnuIrcPref.Click,
mnuIrcExit.Click

Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Connect"
netBots.ConnectServer()
Case "Preferences..."
Dim frmPref As New PirateChat.frmPreferences
frmPref.MdiParent = Me
frmPref.Show()
Case "Exit"
Me.Close()
End Select
End Sub

Private Sub mnuServer_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuSerAdm.Click, mnuSerMotd.Click,
mnuSerInfo.Click, _
mnuSerMap.Click, mnuSerLink.Click, mnuSerVer.Click, mnuSerCom.Click,
mnuSerTime.Click, mnuSerLoAU.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Admin Info"
Netsock.SendData(Netsock.StringToBytes("admin" &
vbCrLf))
Case "MOTD"
Netsock.SendData(Netsock.StringToBytes("motd" & vbCrLf))
Case "Server Info"
Netsock.SendData(Netsock.StringToBytes("server" &
vbCrLf))
Case "Map Info"
Netsock.SendData(Netsock.StringToBytes("map" & vbCrLf))
Case "Link Info"
Netsock.SendData(Netsock.StringToBytes("links" &
vbCrLf))
Case "Server's Commands"

Case "Server's Time"
Netsock.SendData(Netsock.StringToBytes("time" & vbCrLf))
Case "Server's Version"
Netsock.SendData(Netsock.StringToBytes("version" &
vbCrLf))

Case "List of All Users"
End Select
End Sub

Private Sub mnuInfo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuInfoAlias.Click, mnuInfoStart.Click,
mnuInfoChan.Click, _
mnuInfoNot.Click, mnuInfoserInf.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Aliases..."
mnuFrmHandling(mi.Text)
Case "Startup..."
mnuFrmHandling(mi.Text)
Case "Channels..."
mnuFrmHandling(mi.Text)
Case "Notify lists..."
Dim nlform As New frmNotifyLists
nlform.MdiParent = Me
nlform.Show()
Case "Server's status"

netBots.nStatus.MdiParent = Me
netBots..nStatus.Show()
End Select
End Sub

Private Sub mnuFrmHandling(ByVal frmName As String)

For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next

Dim frmNew As frmAlias
frmNew = New frmAlias
frmNew.MdiParent = Me
frmNew.Name = frmName

Select Case frmName
Case "Aliases..."
frmNew.Text = frmName

Case "Startup..."
frmNew.Text = frmName

Case "Channels..."
frmNew.Text = frmName
End Select
frmNew.Show()
End Sub

End Class
End Namespace
 
S

Supra

i am using public event and withevents
i did try catch end try statement.but not help.
the problem comming from withevents:

Private Sub _Connection_onSeverMessage(ByVal szText As String) Handles
_Connection.onSeverMessage
DisplayMessage(nStatus.rtbStatus, szText)
End Sub
thiss wll work only to effnet, dalnet webmaster. but not to undernet
servers.
regards
 
S

Supra

:*** Looking up your hostname

:*** Checking Ident

:*** Couldn't look up your hostname

PING :1659113236

Helsinki.FI.EU.Undernet.org 001 djanjo2 :Welcome to the UnderNet IRC
Network via EUnet Finland, djanjo2
Helsinki.FI.EU.Undernet.org 002 djanjo2 :Your host is
Helsinki.FI.EU.Undernet.org, running version u2.10.11.06
Helsinki.FI.EU.Undernet.org 003 djanjo2 :This server was created Tue Jan
13 2004 at 08:59:14 EET
Helsinki.FI.EU.Undernet.org 004 djanjo2 Helsinki.FI.EU.Undernet.org
u2.10.11.06 dioswkgx biklmnopstvr bklov
Helsinki.FI.EU.Undernet.org 005 djanjo2 WHOX WALLCHOPS WALLVOICES USERIP
CPRIVMSG CNOTICE SILENCE=15 MODES=6 MAXCHANNELS=20 MAXBANS=45 NICKLEN=12
MAXNICKLEN=15 :are supported by this server
Helsinki.FI.EU.Undernet.org 254 djanjo2 49920 :channels formed
Helsinki.FI.EU.Undernet.org 255 djanjo2 :I have 7188 clients and 1 servers
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,
 
N

Nick Malik [Microsoft]

Sorry that I'm not familiar with the protocol you are using. It appears
that one of the servers you are attempting to contact is responding with an
error message or is dropping the connection unexpectedly, and your code
doesn't handle that possibility very well. It is hard to tell. You posted
a lot of code... most of it is not useful to diagnose your problem. (This
is one reason that we break code into layers... all the code needed to debug
a problem is in one place, and isn't mixed up with other code).

Have you thought about sniffing the packets, so that you can see what the
undernet server is sending you (or not sending you) and you can then look
into your code to see if you are handling it correctly?

Just a suggestion. I hope this is helpful.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 

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