Create string array

  • Thread starter Thread starter RGood
  • Start date Start date
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
 
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
 
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.
 
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
 
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
 
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,
 
Back
Top