Runtime error 9: Subscript out of range

I'm sending data with winsock

Page 1 of 1

2 Replies - 8528 Views - Last Post: 07 May 2010 - 08:03 PM Rate Topic: -----

#1 W0lfbane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 03-April 09

Runtime error 9: Subscript out of range

Posted 07 May 2010 - 05:35 PM

I just got the base of my winsock based monitoring program working (its only for my home network), and I got this error:

After verification is recieved from the client, I call this event from the server program:
Private Sub GetInfo()
Winsock1.SendData "Username" & SPLITTER & UserName
'(I would have other events, but it gets the 
'error even with just this one)
End Sub



SPLITTER tells the recieving program to split the string at that point. It works perfectly for messaging.
Winsock1.SendData "Message" & SPLITTER & "Testing 123"


The UserName variable is in a module which gets this info. It normally works perfectly if I say
label1.caption = "Username: " & UserName'


However, when I send the data, I get this error: 'Runtime Error 9: Subscript out of range'


It can't be the length of the string, as the username I'm testing on is 5 characters (ADMIN), and Messaging works with sentences.

Could it be the method used to get the username (but putting it in another string first doesn't help)?

If you need it, just tell me to post the module I use to get the info (got it from the internet anyway), but its several pages long (thats why I didn't post it now)

Please Help.

This post has been edited by W0lfbane: 07 May 2010 - 05:37 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Runtime error 9: Subscript out of range

#2 renmee   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 158
  • Joined: 20-July 09

Re: Runtime error 9: Subscript out of range

Posted 07 May 2010 - 07:26 PM

Use the Debug then roll over you mouse on the items and see to it that the data is passing through every lines starting from getting the data from your server this has happened to me before.
Was This Post Helpful? 0
  • +
  • -

#3 W0lfbane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 03-April 09

Re: Runtime error 9: Subscript out of range

Posted 07 May 2010 - 08:03 PM

View Postrenmee, on 07 May 2010 - 06:26 PM, said:

Use the Debug then roll over you mouse on the items and see to it that the data is passing through every lines starting from getting the data from your server this has happened to me before.


Thanks. Did that.

Rundown on what happens until the error:

Client enters IP
Server Recieves connect request, asks for password
Client enters password
Server recieves password, sends "Correct" or "Denied"
Client recieves correct, sends "Recieved"
Server recieves "Recieved", calls "GetInfo"

The error seems to occur when the server recieves "Recieved" from the client, not during the "GetInfo" event.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1