?
Solved

Stupid Question VB Split Function

Posted on 2003-03-01
4
Medium Priority
?
179 Views
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...

Thanks



0
Comment
Question by:flosoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
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

ArrayArgs(USER_NAME)

0
 

Author Comment

by:flosoft
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,192.168.254.101,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.
0
 
LVL 5

Expert Comment

by:JohnMcCann
ID: 8050797
No probs
0
 
LVL 5

Expert Comment

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

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

800 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