Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comma in String to ListBox 1

Status
Not open for further replies.

sucoyant

IS-IT--Management
Sep 21, 2002
213
US
Good day!

I have a textbox that gets placed into a variable that's "dim"ed as a String.

This textbox allows quite a bit, including comma's (,). When this string includes a comma, and I try to place it into a listbox, it seperates the sentence.

For example:
Code:
dim strItem as string

strItem = Me.txtStuff

Me.lstOJunk.Additem (strItem)

If txtStuff = "Hello, my name is Sucoyant"

It will be placed into the listbox like this:
Hello
my name is Sucoyant


Is there any way I can work around this, so it will create just one entry, instead of seperating it after the comma?

Thanks in advance!





________________________________________
BUDDHA.gif
Buddha. Dharma. Sangha.
 
A workaround is to replace all commas with another character, something like this:
Code:
dim strItem as string
strItem = Replace(Me.txtStuff, ",", "'")
Me.lstOJunk.Additem (strItem)

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Ahh yes. PHV you are the best.
Thanks!

________________________________________
BUDDHA.gif
Buddha. Dharma. Sangha.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top