Hey T-RonX,
I'm coding like 2 days now in VB with your LFS External and I get it bit by bit...
My knowledge of VB is good, but not excellent ^^ Forgive me for the crappy code =$
I'm trying to make a visual admin panel but I have this error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
In this piece of code:
Me.Invoke(New dlgMSO(AddressOf MSO_MessageOut), p)
The total code is listed here:
Private Sub MSO_MessageOut(ByVal MSO As Packets.IS_MSO)
'Invoke method due to threading. Add this line to any receive event before updating the GUI. Just like in this example, you only have to add a new delegate with the right packet parameter and adjust this line in the new method.
If DoInvoke() Then
Dim p As Object = MSO
Me.Invoke(New dlgMSO(AddressOf MSO_MessageOut), p)
Return
End If
'tekst.Replace(Connections(GetConnIdx(MSO.UCID)).PlayerName, "").Replace("^0", "").Replace("^1", "").Replace("^2", "").Replace("^3", "").Replace("^4", "").Replace("^5", "").Replace("^6", "").Replace("^7", "").Replace("^8", "")
Dim tekst As String = MSO.Msg.Substring(MSO.TextStart, (MSO.Msg.Length - MSO.TextStart))
Dim msg() As String = tekst.Split()
Select Case msg(0)
Case "!online"
InSim.Send_BTN_CreateButton("Players: " & CStr(Players.Count), Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 30, 10, 20, 99, MSO.UCID, 99, True)
Case "!connections"
InSim.Send_BTN_CreateButton("Connecties: " & CStr(Connections.Count), Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 30, 15, 20, 98, MSO.UCID, 98, True)
Case "!userlist"
Dim i As Integer = 1
Dim k As Integer = 0
'InSim.Send_BTN_CreateButton("Exit", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 10, 20, 30, 10, 97, MSO.UCID, 97, True)
For i = 1 To Connections.Count
k = 0
InSim.Send_BTN_CreateButton(Connections(i).PlayerName, Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 20 + 5, 20, i, MSO.UCID, i, True)
k = CInt(CStr(i) + "1")
InSim.Send_BTN_CreateButton("Kick", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 40, k, MSO.UCID, k, True)
k = CInt(CStr(i) + "2")
InSim.Send_BTN_CreateButton("Ban 1 day", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 60, k, MSO.UCID, k, True)
k = CInt(CStr(i) + "3")
InSim.Send_BTN_CreateButton("Ban 7 days", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 80, k, MSO.UCID, k, True)
k = CInt(CStr(i) + "4")
InSim.Send_BTN_CreateButton("Ban forever", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 100, k, MSO.UCID, k, True)
Next i
End Select
TextBox1.Text += tekst & Constants.vbCrLf
End Sub
When I put my For i = connection.count... loop in comment, I don't get an error...
UPDATE:
Tested a bit further and I get the error when I try this: Connections(i).PlayerName
This command in the loop should get all the PlayerNames of al the people who are connected with the server... Do I do this wrong or is there another way?