PC Review


Reply
Thread Tools Rate Thread

displaying delimited text

 
 
Ron
Guest
Posts: n/a
 
      26th Feb 2007
How do I display delimited text on multiple lines in a listbox?

For example in my textbox I have this:
Joe Doe,123 Street,Mytown

and In a listbox then I want to display:
Joe Doe
123 Street
Mytown

How would I step through that string and seperate the words by the
comma?

 
Reply With Quote
 
 
 
 
Tom Shelton
Guest
Posts: n/a
 
      26th Feb 2007
On Feb 26, 9:43 am, "Ron" <pts4...@yahoo.com> wrote:
> How do I display delimited text on multiple lines in a listbox?
>
> For example in my textbox I have this:
> Joe Doe,123 Street,Mytown
>
> and In a listbox then I want to display:
> Joe Doe
> 123 Street
> Mytown
>
> How would I step through that string and seperate the words by the
> comma?


Cation - air code follows:
listbox1.items.addrange(delimited.Split(",".ToCharArray()))

--
Tom Shelton

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      26th Feb 2007
"Tom Shelton" <(E-Mail Removed)> schrieb:
>> How do I display delimited text on multiple lines in a listbox?
>>
>> For example in my textbox I have this:
>> Joe Doe,123 Street,Mytown
>>
>> and In a listbox then I want to display:
>> Joe Doe
>> 123 Street
>> Mytown
>>
>> How would I step through that string and seperate the words by the
>> comma?

>
> Cation - air code follows:
> listbox1.items.addrange(delimited.Split(",".ToCharArray()))


.... => 'delimited.Split(","c)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
 
Reply With Quote
 
Ron
Guest
Posts: n/a
 
      27th Feb 2007
so if my textbox is named textbox1 and my listbox is named
ltsdisplay, for the button that would make this all happen I would
just need to:

lstdisplay.items.textbox1(delimited.Split(",".ToCharArray()))

is that right? or no? I try this and I get an error...


On Feb 26, 5:20 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.at> wrote:
> "Tom Shelton" <tom_shel...@comcast.net> schrieb:
>
> >> How do I display delimited text on multiple lines in a listbox?

>
> >> For example in my textbox I have this:
> >> Joe Doe,123 Street,Mytown

>
> >> and In a listbox then I want to display:
> >> Joe Doe
> >> 123 Street
> >> Mytown

>
> >> How would I step through that string and seperate the words by the
> >> comma?

>
> > Cation - air code follows:
> > listbox1.items.addrange(delimited.Split(",".ToCharArray()))

>
> ... => 'delimited.Split(","c)'.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



 
Reply With Quote
 
\(O\)enone
Guest
Posts: n/a
 
      27th Feb 2007
Ron wrote:
> so if my textbox is named textbox1 and my listbox is named
> ltsdisplay, for the button that would make this all happen I would
> just need to:
>
> lstdisplay.items.textbox1(delimited.Split(",".ToCharArray()))
>
> is that right?


Not quite.

"delimited" in the samples you've been given is the delimited string, which
in your case is "Textbox1.Text" (that's where the system gets the delimited
string from).

And also the code is more concise using Herfried's suggestion of how to
provide a character variable containing a comma.

Try this:

\\\
lstDisplay.Items.AddRange(Textbox1.Text.Split(","c))
///

--

(O)enone


 
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
Text to columns and comma delimited text flashback Microsoft Excel Programming 5 16th Sep 2010 05:14 PM
Converting Pipe Delimited Text File To Tab Delimited Text file Probie Coder Microsoft Access VBA Modules 5 3rd Dec 2009 05:56 AM
Japanese text lost when save as tab delimited text file Greg Lovern Microsoft Excel Programming 0 24th Oct 2007 08:39 PM
Converting Tab Delimited Text File to A Comma Delimited Text File kwesi.acquah@gmail.com Microsoft Excel Programming 1 13th Jun 2007 03:13 PM
Exporting Text with a data to a delimited text file =?Utf-8?B?RCBIYWZlciAtIFRGRQ==?= Microsoft Access External Data 4 5th Sep 2006 06:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:22 AM.