Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Stupid Question VB Split Function

Posted on 2003-03-01
Medium Priority
Last Modified: 2013-11-13
I am sending data from one winsock to another, I can format this in a string as so...

StrString = Username,IP,Lport,RPort,FileName,Message

This is devided by comma delimited...and I have tried a bunch of characters to extract this..maybe I am just tired

What I need to do is this... break the string up
Take strString and put it into:

Dim User as string = The user in the string
Dim IP as string = The IP from the string
dim LPort as String = The Lport
dim RPorts as string = the RPort
Dim Filename as String = The File name
Dim Message as string = The message

I need this "broke out" of the string ...I am sure you get this, I forgot how to do it right and my ms help stuff doesnot remind me...


Question by:flosoft
  • 3

Accepted Solution

JohnMcCann earned 200 total points
ID: 8050715
Dim ArrayArgs() as string

Const USER_NAME = 1

ArrayArgs = split("Username,IP,Lport,RPort,FileName,Message",",")

Then use



Author Comment

ID: 8050775
LOL...I figured it out just before I got your comment, I just did the number after...like this:
Private Sub Command1_Click()
'Text1.Text = "User1,,2000,4000,c:\readme.txt,This is a text file"
Dim InputString
Dim Name As String
Dim IP As String
Dim LPort As String
Dim RPort As String
Dim FileName As String
Dim Message As String

InputString = Text1.Text
InputString = Split(InputString, ",", -1)
Name = InputString(0)
IP = InputString(1)
LPort = InputString(2)
RPort = InputString(3)
FileName = InputString(4)
Message = InputString(5)

MsgBox "Name" & Name & vbCrLf _
& "IP:" & IP & vbCrLf & "Local Port: " & LPort _
& vbCrLf & "Remote Port: " & RPort & vbCrLf & _
"File to be transfered: " & FileName & vbCrLf & _
"Message from sender: " & Message, vbInformation, "Split Test"
End Sub

Both do exactly the same thing, but your way is way better for true newbie as your pre-names the splits. I do thank you for your comment, and I am letting the points go...thanks.

Expert Comment

ID: 8050797
No probs

Expert Comment

ID: 8050920
To let the points go and close the question you must click accept answer

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question