Create string array

R

RGood

Hi,
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string array
or ArrayList
since i would not know how many strings are in the TextBox?

Thanks, Ron
 
R

RGood

I think i need to use the Split() method but i am not quite sure how the
syntax would look an example would be most appeciated.
Thanks, Ron
 
A

Armin Zingler

RGood said:
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string
array or ArrayList
since i would not know how many strings are in the TextBox?

Use the string's split method. It returns a string array.
 
S

Snappy McFeestleborkenheimer

Ron:

Search the MSDN for the Split method. It take a char array of delimiters (in
your case, only 1 element: the semicolon), and automatically splits the
string into a string Array. The page in the MSDN has a great example.

HTH
 
R

RGood

Snappy,
Thanks i will take a look.

Snappy McFeestleborkenheimer said:
Ron:

Search the MSDN for the Split method. It take a char array of delimiters (in
your case, only 1 element: the semicolon), and automatically splits the
string into a string Array. The page in the MSDN has a great example.

HTH
 
T

Tom Spink

Hi there:

Dim strStringArray() As String = TextBox1.Text.Split(";"c)

strStringArray is your string array, and ";"c means split the string between
the ; chars. Notice the c after the string definition, it means that it's
not a string, it's a char.

--
Happy to help,
-- Tom Spink
([email protected])

http://dotnetx.betasafe.com >> On The Mend

Please respond to the newsgroup,
so all can benefit.


One Day,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top