PC Review


Reply
Thread Tools Rate Thread

Create string array

 
 
RGood
Guest
Posts: n/a
 
      10th Jul 2003
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


 
Reply With Quote
 
 
 
 
RGood
Guest
Posts: n/a
 
      10th Jul 2003
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" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:OP%23%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      10th Jul 2003
"RGood" <rgood1@no_spam_4me_woh.rr.com> schrieb
> 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.


--
Armin

 
Reply With Quote
 
Snappy McFeestleborkenheimer
Guest
Posts: n/a
 
      10th Jul 2003
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

"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:OP%23%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
RGood
Guest
Posts: n/a
 
      10th Jul 2003
Snappy,
Thanks i will take a look.

"Snappy McFeestleborkenheimer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> "RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
> news:OP%23%(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
Tom Spink
Guest
Posts: n/a
 
      10th Jul 2003
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
((E-Mail Removed))

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

Please respond to the newsgroup,
so all can benefit.


One Day,
"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:#(E-Mail Removed)...
> 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" <rgood1@no_spam_4me_woh.rr.com> wrote in message
> news:OP%23%(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a string array from string NuBBeR Microsoft C# .NET 0 5th Oct 2004 09:44 PM
Cannot create an object of type 'System.String[]' from its string representation 'String[] Array' for the 'Options' property. Hessam Microsoft C# .NET 0 8th Aug 2003 09:45 AM
Cannot create an object of type 'System.String[]' from its representation 'String[] Array' Hessam Microsoft Dot NET 0 8th Aug 2003 09:36 AM
Cannot create an object of type 'System.String[]' from its representation 'String[] Array' Hessam Microsoft Dot NET Framework 0 8th Aug 2003 09:36 AM
Cannot create an object of type 'System.String[]' from its representation 'String[] Array' Hessam Microsoft ASP .NET 0 8th Aug 2003 09:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:28 PM.