|
-
Apr 27th, 2005, 05:56 PM
#1
Thread Starter
New Member
Winsock recieve data help [Resolved]
my code works, but i want to add something to it
Code:
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
' get the data and display it in the textbox
Winsock.GetData strData
txtMain.Text = txtMain.Text & vbCrLf & "Client: " & strData
txtMain.SelStart = Len(txtMain.Text)
End Sub
i want to make it take the first two words of the string, and have the first go into one variable and the second go into another, then all words after the first two get put in yet another variable. how would i go about doing this?
edit: i also want it to still put all of the string into the text box.
Last edited by camman977; Apr 28th, 2005 at 03:32 PM.
-
Apr 27th, 2005, 11:21 PM
#2
Re: Winsock recieve data help
This will split the words. What you do with firstTwo and lastFew is up to you 
VB Code:
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Dim arr() as String
Dim firstTwo$, lastFew$, x%
' get the data and display it in the textbox
Winsock.GetData strData
' ---------------------------------------------------
arr() = Split(strData, " ") ' Split into words
firstTwo = arr(0) & " " & arr(1) ' First two words
for x=2 to Ubound(arr)
lastFew = lastFew & arr(x) & " " ' Rest of the words
next x
' ---------------------------------------------------
txtMain.Text = txtMain.Text & vbCrLf & "Client: " & strData
txtMain.SelStart = Len(txtMain.Text)
End Sub
-
Apr 28th, 2005, 03:32 PM
#3
Thread Starter
New Member
Re: Winsock recieve data help [Resolved]
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
|