Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21140

object array element 2 doesnt exist error

$
0
0
i had 3 clients open and logged out 1 client and i get this error

Code:

Private Function GetAvailableSocketIndex() As Integer
      Dim AvailIndex As Integer
    Dim SocketElement As Variant
    Dim n As Integer
'AvailIndex = 0
 For n = AcceptedSocket.Count - 1 To 1 Step -1
 
  If AcceptedSocket(n).State = sckClosed Then    <<< the (n) count has 2
 
    GetAvailableSocketIndex = n
    Exit Function
  End If
 Next n
 
 GetAvailableSocketIndex = AcceptedSocket.Count
 Load AcceptedSocket(GetAvailableSocketIndex)
End Function


Viewing all articles
Browse latest Browse all 21140

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>