I know its been asked numerous of times about threading and null.reference.exception and what not and i have read every each of solutions provided, but i still couldn't figuring it out some of those nasty exceptions. i just started coding in .net and i have no clue whats wrong with my code. as far as i can tell i left nothing nulled behind. I got several exceptions in my app but these 2 points are where i couldn't fix'em :
one here:
And one here:
as i mentioned in the codes, the errors happens where there is no explanation for me, i checked and as far as i can tell i left nothing nulled behind, but... sorry im a very very ****ty coder, all that matters to me is my code to run! so if u guys have any recommendation / optimization, you are very very welcomed my friends! :triumphant:
thanx again
one here:
VB.NET:
Private Sub OnIncomingMessage(ByVal Args As UNOLibs.Net.ServerClass.InMessEvArgs) Handles Srv.IncomingMessage
If Me.InvokeRequired Then '//i fixed the thread instance thing warning but not nullrefrence one
Dim d As New SetTextCallback(AddressOf OnIncomingMessage)
Me.Invoke(d, New Object() {Args})
return
End If
Dim sip As String = Args.senderIP
Dim DATA As String = Args.message
''/////////////////////////////////////////
lb1.Items.Add(sip & "-->" & Data) <=== THIS LINE
usr_ip.Text = sip
Parser(Data)
End Sub
And one here:
VB.NET:
Dim strng As String = str
Dim p As New StringParser(strng)
b = "|"
Try
Do While p.skipToStartOfNoCase(b)
If p.skipToEndOfNoCase(b) AndAlso p.extractUntilNoCase(b, strExtract) Then
a.Add(strExtract)
End If
Loop
Get_Inst(a, a(1))
SetItems(a(1))
Catch ex As Exception
''/// if i don't disable this line i get the msgbox even when errors occur in the previous "THIS LINE" mark or next one.
MsgBox(ex.Message, MsgBoxStyle.Critical, "Bad input string in Parser")
End Try
End Sub
Private Sub Get_Inst(ByVal Ent As ArrayList, ByVal Indx As Integer)
Select Case Ent(0)
Case "S"
Select Case Indx
Case 0, 1, 2, 3, 4, 6, 7, 8, 9
For i = 2 To Ent.Count - 1
SetItems(Indx)
'Me.Controls("checkbox" & i).Visible = Ent(i)
Dim cb As CheckBox = DirectCast(Me.Controls("CheckBox" & i), CheckBox)
cb.Checked = Ent(i) <==== THIS LINE
Next
End Select
Case "I"
End Select
End Sub
as i mentioned in the codes, the errors happens where there is no explanation for me, i checked and as far as i can tell i left nothing nulled behind, but... sorry im a very very ****ty coder, all that matters to me is my code to run! so if u guys have any recommendation / optimization, you are very very welcomed my friends! :triumphant:
thanx again