mrnew
Aug 8th, 2006, 07:31 AM
Hi
im trying to send the data to the server 1 by 1 instead of just one string,
but this way dont seem to work atall.
i commented out some code and chucked a msgbox on to test it and it works successfully...i just cant do the same when sending the info from the server to the client.
its most likely the dataArrival sub thats wrong so can somebody show me how its wrong and how to fix please.
Public Sub HighScore(index As Integer)
On Error Resume Next
Dim TopTen(9) As UserData
Dim tmp As UserData
Dim i As Long
Dim j As Long
Dim Msg As String
Msg = Chr$(251) & Chr$(2)
' In case the highest reputations could be less than zero
For i = 0 To 9
TopTen(i).Reputation = -999
Next i
For i = 0 To UBound(UserDB)
If UserDB(i).Reputation > TopTen(9).Reputation Then
TopTen(9) = UserDB(i)
For j = 8 To 0 Step -1
If TopTen(j).Reputation < TopTen(j + 1).Reputation Then
tmp = TopTen(j)
TopTen(j) = TopTen(j + 1)
TopTen(j + 1) = tmp
Else
Exit For
End If
Next j
End If
Next i
For i = 0 To 9
Msg = TopTen(i).Reputation & TopTen(i).UName & TopTen(i).Rank
MsgBox Msg
'frmMain.wsk(index).SendData Msg
'DoEvents
Next i
End Sub
'the below code is on the client
Private Sub wsk_DataArrival(ByVal bytesTotal As Long)
Dim a As Integer
Dim Msg As String
Dim SplitMsg() As String
wsk.GetData Msg, vbString
SplitMsg = Split(Msg, Chr$(0))
For a = 0 To UBound(SplitMsg) - 1
Select Case Left$(SplitMsg(a), 2)
Case Chr$(251) & Chr$(2)
'frmMain.lsthighscore.AddItem Mid$(SplitMsg(a), 3) ' dont work
MsgBox Msg ' dont work
End Select
im trying to send the data to the server 1 by 1 instead of just one string,
but this way dont seem to work atall.
i commented out some code and chucked a msgbox on to test it and it works successfully...i just cant do the same when sending the info from the server to the client.
its most likely the dataArrival sub thats wrong so can somebody show me how its wrong and how to fix please.
Public Sub HighScore(index As Integer)
On Error Resume Next
Dim TopTen(9) As UserData
Dim tmp As UserData
Dim i As Long
Dim j As Long
Dim Msg As String
Msg = Chr$(251) & Chr$(2)
' In case the highest reputations could be less than zero
For i = 0 To 9
TopTen(i).Reputation = -999
Next i
For i = 0 To UBound(UserDB)
If UserDB(i).Reputation > TopTen(9).Reputation Then
TopTen(9) = UserDB(i)
For j = 8 To 0 Step -1
If TopTen(j).Reputation < TopTen(j + 1).Reputation Then
tmp = TopTen(j)
TopTen(j) = TopTen(j + 1)
TopTen(j + 1) = tmp
Else
Exit For
End If
Next j
End If
Next i
For i = 0 To 9
Msg = TopTen(i).Reputation & TopTen(i).UName & TopTen(i).Rank
MsgBox Msg
'frmMain.wsk(index).SendData Msg
'DoEvents
Next i
End Sub
'the below code is on the client
Private Sub wsk_DataArrival(ByVal bytesTotal As Long)
Dim a As Integer
Dim Msg As String
Dim SplitMsg() As String
wsk.GetData Msg, vbString
SplitMsg = Split(Msg, Chr$(0))
For a = 0 To UBound(SplitMsg) - 1
Select Case Left$(SplitMsg(a), 2)
Case Chr$(251) & Chr$(2)
'frmMain.lsthighscore.AddItem Mid$(SplitMsg(a), 3) ' dont work
MsgBox Msg ' dont work
End Select