|
-
Sep 20th, 2007, 12:21 PM
#1
Thread Starter
Member
Msgbox winsock1
Hey,
I'm trying to have a parent type program made. 1 of the options to do is send a msgbox. For the Client I have this for the send button.
Code:
Private Sub Command2_Click()
Winsock1.SendData Text2.Text, Value, Text1.Text
End Sub
Which I get an error on but If I put in Winsock1.SendData "hello"
Then on the server the msgbox pops up with the msg but the title of the msg wont change. Here is the server getdata code.
Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim msg As String
Winsock1.GetData msg
MsgBox msg
End Sub
Anyway to get the title and msg of the msgbox to show up and work correctly?
-
Sep 20th, 2007, 06:35 PM
#2
Re: Msgbox winsock1
It's not going to work that way.
SendData can only be 1 argument. By adding two comma's, like you have now, you are trying to pas 3 arguments. A messagebox always uses the name of the project as a title, unless you specify what title should be used.
I don't know what the data is you have in Text1, Text2 and Value, but try something like this:
Code:
Option Explicit
'I assume that Text2.Text contains the message
'I assume that Value is part of the message as well
'I assume that Text1.Text is the title of the messagebox
Private Sub Command1_Click()
Dim Value As Long
'We have to send the data as one piece, so we join all data
'The data is separated by vertical bars, so the data can be
'easily separated in the DataArrival event
Winsock1.SendData Text2.Text & "|" & Value & "|" & Text1.Text
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim msg As String
Dim arrText() As String 'array to hold the various data
Winsock1.GetData msg
arrText = Split(msg, "|") 'here we split the incoming data,
'by using the vertical bars again
'arrText(0) = Text2.Text
'arrText(1) = Value
'arrText(2) = Text1.Text
MsgBox arrText(0) & " - " & arrText(1), vbInformation, arrText(2)
End Sub
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
|