An unhandled exception of type 'System...............

  • Thread starter Thread starter Supra
  • Start date Start date
S

Supra

i got error problem..........
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..


Namespace PirateChat <========== error occurred in here

Public Class mainPirateChat
Inherits System.Windows.Forms.Form.
..
..
..
..
..
End Class
End Namespace

i have search in microsoft and google too. but i don't see nothing
declaring variables. the only i wrote small code that fine. but when i
added some more codes i got error problem.
how to i trap error problem?
regards,
 
Supra,

I do not see it directly, what I am first thinking about, is that it is not
impossible that you have an endless loop and your program goes out of mem.

Cor
 
here is debug:

NOTICE AUTH :*** Looking up your hostname
NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Couldn't look up your hostname

PING :23273344

Oslo2.NO.EU.undernet.org 001 djanjo2 :Welcome to the UnderNet IRC
Network, djanjo2
Oslo2.NO.EU.undernet.org 002 djanjo2 :Your host is
Oslo2.NO.EU.undernet.org, running version u2.10.11.06
Oslo2.NO.EU.undernet.org 003 djanjo2 :This server was created Sun Jan 11
2004 at 04:21:44 CET
Oslo2.NO.EU.undernet.org 004 djanjo2 Oslo2.NO.EU.undernet.org
u2.10.11.06 dioswkgx biklmnopstvr bklov
Oslo2.NO.EU.undernet.org 255 djanjo2 :I have 5132 clients and 1 servers
:Highest connection count: 7804 (7803 clients)
Oslo2.NO.EU.undernet.org 375 djanjo2 :- Oslo2.NO.EU.undernet.org Message
of the Day -
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.
;
;
;
at PirateChat.PirateChat.mainPirateChat.Main() in C:\Documents and
Settings\Afraz\My Documents\Visual Studio
Projects\VbNet\project\PirateChat\mainPirateChat.vb:line 14

I don't see nothing "instance of object"
additional information: Object reference not set to an instance of an
object..
regards
 
Supra said:
here is debug:
at PirateChat.PirateChat.mainPirateChat.Main() in C:\Documents and
Settings\Afraz\My Documents\Visual Studio
Projects\VbNet\project\PirateChat\mainPirateChat.vb:line 14

Can you post the source code of your main method? What's the code on line
14?
 
'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 <===== The error occurred here in line 14
Inherits System.Windows.Forms.Form

Private WithEvents netBots As New PirateChat.ClientFactory
Private WithEvents Netsock As New PirateChat.SockFactory
Dim clsReader As New PirateChat.clsReadWriteXML
Dim nlform As New PirateChat.frmNotifyLists
Dim frmPref As New PirateChat.frmPreferences
:
:
:
:
End Class
End Namespace
 
everytimes i changed and modified code again.this is comming from this
event i put another first class.vb and this second class.vb is calling
from first class . and second class goes into mainPirchatechat form.

this is first class. if i change code again i will get error line 14
from mainPirateChat form
Private Sub Netsock_onDataArrival(ByVal Data() As Byte, ByVal
TotalBytes As Integer) Handles Netsock.onDataArrival
Dim inData As String = Netsock.BytestoString(Data)
Dim lData(), C(), CLi As String, tData, CL, a, i As Integer
Dim b() As String

lData = Split(inData, Chr(10))
tData = UBound(lData) - LBound(lData)

For a = 0 To tData
If Mid(lData(a), 1, 1) = ":" Then
lData(a) = Mid(lData(a), 2)
End If
Next

For CL = 0 To tData
C = Split(lData(CL), " ")
ReDim Preserve C(32767)
CLi = lData(CL)

Dim spNick As String(), sNick As String
Dim strNick As String = CLi
spNick = strNick.Split("!")
sNick = spNick(0)

If C(0) = "PING" Then
'
nStatus.rtbStatus.DisplayMessage(nStatus.rtbStatus, "PONG :" &
C(1).Substring(1))
RaiseEvent onSeverMessage("PONG :" & C(1).Substring(1))
Netsock.SendData(Netsock.StringToBytes("PONG :" &
C(1).Substring(1) & vbCrLf))
End If

If C(0) = "ERROR" Then
Dim int2 As Integer = CLi.IndexOf(":")
CLi = CLi.Substring(int2 + 1)
RaiseEvent onSeverMessage(CLi.ToString)
End If

If C(0) = "NOTICE" Then
Dim int3 As Integer = CLi.IndexOf("NOTICE")
CLi = CLi.Substring(C(0).Length - 6)
RaiseEvent onSeverMessage(CLi)
ElseIf C(1) = "NOTICE" And C(2) = "AUTH" Then
Dim int1 As Integer = CLi.IndexOf(C(0))
CLi = CLi.Substring(C(0).Length)
RaiseEvent onSeverMessage(CLi)
ElseIf C(1) = "NOTICE" And C(2) = Netsock.Nick Then
Dim nic As Integer = CLi.IndexOf(C(0))
CLi = CLi.Substring(C(0).Length + 1 + C(1).Length +
1 + Netsock.Nick.Length)
RaiseEvent onSeverMessage(CLi)
End If

'Select Case C(1)
'Case "001" To "376"
If C(2) = Netsock.Nick Then
Dim servString As String
Dim intI As Integer = CLi.IndexOf(Netsock.Nick)
servString = CLi.Substring(intI + Netsock.Nick.Length)
RaiseEvent onSeverMessage(servString)
servString = String.Empty
End If
'End Select
Debug.WriteLine(CLi)

Next
End Sub

regards,
 
Herfried,
i solved it.
regards,
everytimes i changed and modified code again.this is comming from this
event i put another first class.vb and this second class.vb is calling
from first class . and second class goes into mainPirchatechat form.

this is first class. if i change code again i will get error line 14
from mainPirateChat form
Private Sub Netsock_onDataArrival(ByVal Data() As Byte, ByVal
TotalBytes As Integer) Handles Netsock.onDataArrival
Dim inData As String = Netsock.BytestoString(Data)
Dim lData(), C(), CLi As String, tData, CL, a, i As Integer
Dim b() As String

lData = Split(inData, Chr(10))
tData = UBound(lData) - LBound(lData)

For a = 0 To tData
If Mid(lData(a), 1, 1) = ":" Then
lData(a) = Mid(lData(a), 2)
End If
Next

For CL = 0 To tData
C = Split(lData(CL), " ")
ReDim Preserve C(32767)
CLi = lData(CL)

Dim spNick As String(), sNick As String
Dim strNick As String = CLi
spNick = strNick.Split("!")
sNick = spNick(0)

If C(0) = "PING" Then
'
nStatus.rtbStatus.DisplayMessage(nStatus.rtbStatus, "PONG :" &
C(1).Substring(1))
RaiseEvent onSeverMessage("PONG :" &
C(1).Substring(1))
Netsock.SendData(Netsock.StringToBytes("PONG :" &
C(1).Substring(1) & vbCrLf))
End If

If C(0) = "ERROR" Then
Dim int2 As Integer = CLi.IndexOf(":")
CLi = CLi.Substring(int2 + 1)
RaiseEvent onSeverMessage(CLi.ToString)
End If

If C(0) = "NOTICE" Then
Dim int3 As Integer = CLi.IndexOf("NOTICE")
CLi = CLi.Substring(C(0).Length - 6)
RaiseEvent onSeverMessage(CLi)
ElseIf C(1) = "NOTICE" And C(2) = "AUTH" Then
Dim int1 As Integer = CLi.IndexOf(C(0))
CLi = CLi.Substring(C(0).Length)
RaiseEvent onSeverMessage(CLi)
ElseIf C(1) = "NOTICE" And C(2) = Netsock.Nick Then
Dim nic As Integer = CLi.IndexOf(C(0))
CLi = CLi.Substring(C(0).Length + 1 + C(1).Length +
1 + Netsock.Nick.Length)
RaiseEvent onSeverMessage(CLi)
End If

'Select Case C(1)
'Case "001" To "376"
If C(2) = Netsock.Nick Then
Dim servString As String
Dim intI As Integer = CLi.IndexOf(Netsock.Nick)
servString = CLi.Substring(intI + Netsock.Nick.Length)
RaiseEvent onSeverMessage(servString)
servString = String.Empty
End If
'End Select
Debug.WriteLine(CLi)

Next
End Sub

regards,
 
Back
Top