yeah i ben having weird ass runtime errors as it says when i join a channel with more than 10 users in it..... i get this error sometimes when i do join the channel with more than 10 users in it.
--------------------------------------------------------
'Run-time error '5':
Invalid procedure call or argument
--------------------------------------------------------
when i select debug it sends me to this snippet of code.
Private Sub sckBnet_DataArrival(ByVal bytesTotal As Long)
Dim strBuffer As String, strTemp As String, lngLen As Long
frmMain.sckBnet.GetData strTemp, vbString
strBuffer = strBuffer & strTemp
While Len(strBuffer) > 4
lngLen = Val("&H" & StrToHex(StrReverse(Mid(strBuffer, 3, 2))))
If Len(strBuffer) < lngLen Then Exit Sub
Parse (Left(strBuffer, lngLen)) <<<--------- This is the highlighted text when debugged
strBuffer = Mid(strBuffer, lngLen + 1)
Wend
End Sub
If anyone can help me with this problem it would be greatful...
You're probably not getting the entire packet, so when you attempt to do Left(data,length) Left won't work.
is there any way to remedy this problem?
Compare the length of the buffer with the length the packet should be, if the length is too short, assume the next packet you will be receiving contains more (if not the rest) of your packet.
Quote from: Noodlez on May 12, 2003, 06:48 PM
You're probably not getting the entire packet, so when you attempt to do Left(data,length) Left won't work.
i don't think left will ever cause a runtime error...it'll just assume you meant the entire string if you put a longer length
Camel, you're correct. You do get an Invalid procedure call or argument if the length is negative though.
Vial, use the Debug.Print for the length and check what the last one is on error.
I talked to Spht on battle.net and he told me that if i put:
On Error Resume Next
it should prevent some of the erros that occur when i join a channel, it don't make the Run-time error anymore though, but the bot crashes now when i have that code in it. I need to take a break i'm wreaking my brain over it..
*Pops some Advil*
just a commment: On Error Resume Next is sort of a last ditch resort: it absolutely does not solve the problem; it simply prevents vb from reporting the error. if you want to handle the error, you might try On Error Goto <lable>
Quote from: ViaL on May 12, 2003, 09:19 PM
I talked to Spht on battle.net and he told me that if i put:
On Error Resume Next
it should prevent some of the erros that occur when i join a channel, it don't make the Run-time error anymore though, but the bot crashes now when i have that code in it. I need to take a break i'm wreaking my brain over it..
*Pops some Advil*
...Huh? I wasn't talking to anyone on Battle.net lately about Visual Basic, and I wouldn't suggest you to use that statement [see Camel's reply]. I believe you have me mistaken for someone else.
+1 for linux avatar + vb question