|
-
Feb 26th, 2006, 10:25 PM
#1
Thread Starter
Junior Member
Remote Message Box Popup
im having little piss of problems with my code can someone tell me whats wrong with it ?
Visual Basic 6.0
In Client
VB Code:
Private Sub cmdSend_Click()
Dim Data10
Data10 = txtNick.Text & ": " & txtMessage.Text
Winsock.SendData Data10
End Sub
In Server
VB Code:
Case "Data10"
Winsock(Index).GetData incommingData, vbString
If incommingData = "Data10" Then
Data10 = MsgBox Date10, ("Message From Master")
End If
Exit Sub
If anyone can fix it up and tlel me what was wrong it would help me a lot
-
Feb 27th, 2006, 12:56 PM
#2
Re: Remote Message Box Popup
Heres the data arrival sub on server:
VB Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1(Index).GetData strData 'get the data
If Left(strData, 4) = "MSG " Then 'if the first part of the data says MSG
MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master" 'Show msgbox for example Chris: HEY
End If
End Sub
And in the client...
VB Code:
Private Sub cmdSend_Click()
Dim Data as String
Data = "MSG " & txtNick.Text & ": " & txtMessage.Text
Winsock.SendData Data
End Sub
-
Feb 27th, 2006, 04:19 PM
#3
Thread Starter
Junior Member
Re: Remote Message Box Popup
but on server its a Select Case because it has multiple commands
for example on sever I have
VB Code:
Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
Dim incommingData As String
Winsock.GetData incommingData
Select Case incommingData
Case "closeserver"
End
Exit Sub
Case "strData"
Dim strData As String
Winsock.GetData strData
If Left(strData, 4) = "MSG" Then
MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master"End If
Exit Sub
Case "closeserver2"
End
Exit Sub
End Select
End Sub
and on Client I have
VB Code:
Private Sub cmdSend_Click()
Dim strData As String
strData = "MSG" & txtNick.Text & ": " & txtMessage.Text
Winsock.SendData strData
End Sub
should that work im useing Select Case's so... can you help?
-
Feb 28th, 2006, 04:33 AM
#4
Re: Remote Message Box Popup
have this as your select statement...
VB Code:
Select Case incommingData
Case "closeserver"
winsock.Close
Unload Me
Case Left(strData, 4) = "MSG "
MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master"
End Select
-
Feb 28th, 2006, 05:54 AM
#5
Thread Starter
Junior Member
Re: Remote Message Box Popup
-
Feb 28th, 2006, 08:07 AM
#6
Re: Remote Message Box Popup
 Originally Posted by GoldenZero
Vaiable not defined?
What variable?
-
Feb 28th, 2006, 09:07 AM
#7
Re: Remote Message Box Popup
you need to replace strData with incommingData
-
Feb 28th, 2006, 09:11 AM
#8
Re: Remote Message Box Popup
actually that select statement wont work, select only works if you know exactly which part of the data you want to check, if you want to check the first part and all of it, you need an if like in my first post
-
Feb 28th, 2006, 03:43 PM
#9
Thread Starter
Junior Member
Re: Remote Message Box Popup
but what you have in your first post doesn't work
-
Feb 28th, 2006, 04:15 PM
#10
Thread Starter
Junior Member
Re: Remote Message Box Popup
heres what I got
Client
VB Code:
Private Sub cmdSend_Click()
Dim Data10 As String
Data10 = "MSG" & txtNick.Text & ": " & txtMessage.Text
Winsock.SendData Data10
End Sub
Server
VB Code:
Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
Dim incommingData As String
Winsock.GetData incommingData
If Left(incommingData, 4) = "MSG" Then
MsgBox Split(incommingData, ":")(0) & ": " & Split(incommingData, ":")(1), vbInformation, "Message From Master"
End If
Select Case incommingData
Case "closeserver"
End
End Select
It looks ok to me but something wrong.. any ideas?
-
Feb 28th, 2006, 05:06 PM
#11
Re: Remote Message Box Popup
Yes there is a problem with that....if someone posts code...dont change it or it will die, so why have you removed the space after "MSG " ??? read the statement left(..., 4) so theres for characters....."MSG " is 4, you changed it to "MSG" which is three, thats whats wrong
you also changed it in the client part too... "MSG " is what i said, not "MSG" if you want "MSG" then change the number to 3
-
Feb 28th, 2006, 05:18 PM
#12
Thread Starter
Junior Member
Re: Remote Message Box Popup
ohhhhhh I see thanks
ohya I thought you put space by mistake but i see now
Last edited by GoldenZero; Feb 28th, 2006 at 06:24 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|