Recoil Posted June 30, 2015 Posted June 30, 2015 This was happening periodically before the update changes. Now it happens all the time. I can bypass the exception, but there has to be a way to keep it from happening. I have no idea what to do though. A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll Additional information: InvalidArgument=Value of '0' is not valid for 'index'. Sub UpdateUI()     If ConsoleText <> frmServer.txtText.Text Then       frmServer.txtText.Text = ConsoleText       frmServer.txtText.SelectionStart = frmServer.txtText.TextLength       frmServer.txtText.ScrollToCaret()     End If     If NeedToUpDatePlayerList = True Then       UpdateCaption()       For i = 1 To MaxPlayers         If Not Clients(i) Is Nothing Then           If Not Clients(i).Socket Is Nothing Then             If Clients(i).Socket.Connected Then               frmServer.lstView.Items(i - 1).SubItems(1).Text = Clients(i).IP               If Player(i).Login <> "" Then                 frmServer.lstView.Items(i - 1).SubItems(2).Text = Player(i).Login                 If Player(i).Name <> "" Then                   frmServer.lstView.Items(i - 1).SubItems(3).Text = Player(i).Name                 Else                   frmServer.lstView.Items(i - 1).SubItems(3).Text = ""                 End If               Else                 frmServer.lstView.Items(i - 1).SubItems(2).Text = ""                 frmServer.lstView.Items(i - 1).SubItems(3).Text = ""               End If             Else               frmServer.lstView.Items(i - 1).SubItems(1).Text = ""               frmServer.lstView.Items(i - 1).SubItems(2).Text = ""               frmServer.lstView.Items(i - 1).SubItems(3).Text = ""             End If           Else             frmServer.lstView.Items(i - 1).SubItems(1).Text = "" ' <-HERE             frmServer.lstView.Items(i - 1).SubItems(2).Text = ""             frmServer.lstView.Items(i - 1).SubItems(3).Text = ""           End If         Else           frmServer.lstView.Items(i - 1).SubItems(1).Text = ""           frmServer.lstView.Items(i - 1).SubItems(2).Text = ""           frmServer.lstView.Items(i - 1).SubItems(3).Text = ""         End If       Next       NeedToUpDatePlayerList = False     End If   End Sub
Recoil Posted June 30, 2015 Author Posted June 30, 2015 This was happening periodically before the update changes. Now it happens all the time. I can bypass the exception, but there has to be a way to keep it from happening. I have no idea what to do though. A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll Additional information: InvalidArgument=Value of '0' is not valid for 'index'. Sub UpdateUI()     If ConsoleText <> frmServer.txtText.Text Then       frmServer.txtText.Text = ConsoleText       frmServer.txtText.SelectionStart = frmServer.txtText.TextLength       frmServer.txtText.ScrollToCaret()     End If     If NeedToUpDatePlayerList = True Then       UpdateCaption()       For i = 1 To MaxPlayers         If Not Clients(i) Is Nothing Then           If Not Clients(i).Socket Is Nothing Then             If Clients(i).Socket.Connected Then               frmServer.lstView.Items(i - 1).SubItems(1).Text = Clients(i).IP               If Player(i).Login <> "" Then                 frmServer.lstView.Items(i - 1).SubItems(2).Text = Player(i).Login                 If Player(i).Name <> "" Then                   frmServer.lstView.Items(i - 1).SubItems(3).Text = Player(i).Name                 Else                   frmServer.lstView.Items(i - 1).SubItems(3).Text = ""                 End If               Else                 frmServer.lstView.Items(i - 1).SubItems(2).Text = ""                 frmServer.lstView.Items(i - 1).SubItems(3).Text = ""               End If             Else               frmServer.lstView.Items(i - 1).SubItems(1).Text = ""               frmServer.lstView.Items(i - 1).SubItems(2).Text = ""               frmServer.lstView.Items(i - 1).SubItems(3).Text = ""             End If           Else             frmServer.lstView.Items(i - 1).SubItems(1).Text = "" ' <-HERE             frmServer.lstView.Items(i - 1).SubItems(2).Text = ""             frmServer.lstView.Items(i - 1).SubItems(3).Text = ""           End If         Else           frmServer.lstView.Items(i - 1).SubItems(1).Text = ""           frmServer.lstView.Items(i - 1).SubItems(2).Text = ""           frmServer.lstView.Items(i - 1).SubItems(3).Text = ""         End If       Next       NeedToUpDatePlayerList = False     End If   End Sub
Recoil Posted June 30, 2015 Author Posted June 30, 2015 This was happening periodically before the update changes. Now it happens all the time. I can bypass the exception, but there has to be a way to keep it from happening. I have no idea what to do though. A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll Additional information: InvalidArgument=Value of '0' is not valid for 'index'. Sub UpdateUI()     If ConsoleText <> frmServer.txtText.Text Then       frmServer.txtText.Text = ConsoleText       frmServer.txtText.SelectionStart = frmServer.txtText.TextLength       frmServer.txtText.ScrollToCaret()     End If     If NeedToUpDatePlayerList = True Then       UpdateCaption()       For i = 1 To MaxPlayers         If Not Clients(i) Is Nothing Then           If Not Clients(i).Socket Is Nothing Then             If Clients(i).Socket.Connected Then               frmServer.lstView.Items(i - 1).SubItems(1).Text = Clients(i).IP               If Player(i).Login <> "" Then                 frmServer.lstView.Items(i - 1).SubItems(2).Text = Player(i).Login                 If Player(i).Name <> "" Then                   frmServer.lstView.Items(i - 1).SubItems(3).Text = Player(i).Name                 Else                   frmServer.lstView.Items(i - 1).SubItems(3).Text = ""                 End If               Else                 frmServer.lstView.Items(i - 1).SubItems(2).Text = ""                 frmServer.lstView.Items(i - 1).SubItems(3).Text = ""               End If             Else               frmServer.lstView.Items(i - 1).SubItems(1).Text = ""               frmServer.lstView.Items(i - 1).SubItems(2).Text = ""               frmServer.lstView.Items(i - 1).SubItems(3).Text = ""             End If           Else             frmServer.lstView.Items(i - 1).SubItems(1).Text = "" ' <-HERE             frmServer.lstView.Items(i - 1).SubItems(2).Text = ""             frmServer.lstView.Items(i - 1).SubItems(3).Text = ""           End If         Else           frmServer.lstView.Items(i - 1).SubItems(1).Text = ""           frmServer.lstView.Items(i - 1).SubItems(2).Text = ""           frmServer.lstView.Items(i - 1).SubItems(3).Text = ""         End If       Next       NeedToUpDatePlayerList = False     End If   End Sub
Recoil Posted June 30, 2015 Author Posted June 30, 2015 This was happening periodically before the update changes. Now it happens all the time. I can bypass the exception, but there has to be a way to keep it from happening. I have no idea what to do though. A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll Additional information: InvalidArgument=Value of '0' is not valid for 'index'. Sub UpdateUI()     If ConsoleText <> frmServer.txtText.Text Then       frmServer.txtText.Text = ConsoleText       frmServer.txtText.SelectionStart = frmServer.txtText.TextLength       frmServer.txtText.ScrollToCaret()     End If     If NeedToUpDatePlayerList = True Then       UpdateCaption()       For i = 1 To MaxPlayers         If Not Clients(i) Is Nothing Then           If Not Clients(i).Socket Is Nothing Then             If Clients(i).Socket.Connected Then               frmServer.lstView.Items(i - 1).SubItems(1).Text = Clients(i).IP               If Player(i).Login <> "" Then                 frmServer.lstView.Items(i - 1).SubItems(2).Text = Player(i).Login                 If Player(i).Name <> "" Then                   frmServer.lstView.Items(i - 1).SubItems(3).Text = Player(i).Name                 Else                   frmServer.lstView.Items(i - 1).SubItems(3).Text = ""                 End If               Else                 frmServer.lstView.Items(i - 1).SubItems(2).Text = ""                 frmServer.lstView.Items(i - 1).SubItems(3).Text = ""               End If             Else               frmServer.lstView.Items(i - 1).SubItems(1).Text = ""               frmServer.lstView.Items(i - 1).SubItems(2).Text = ""               frmServer.lstView.Items(i - 1).SubItems(3).Text = ""             End If           Else             frmServer.lstView.Items(i - 1).SubItems(1).Text = "" ' <-HERE             frmServer.lstView.Items(i - 1).SubItems(2).Text = ""             frmServer.lstView.Items(i - 1).SubItems(3).Text = ""           End If         Else           frmServer.lstView.Items(i - 1).SubItems(1).Text = ""           frmServer.lstView.Items(i - 1).SubItems(2).Text = ""           frmServer.lstView.Items(i - 1).SubItems(3).Text = ""         End If       Next       NeedToUpDatePlayerList = False     End If   End Sub
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now