[RESOLVED] Parse textbox to listbox - help
How do I parse comma-seperated textbox entries and then populate a listbox?
In my example I have one textbox, let's say I type in the following:
comp1,comp2,comp3,comp4
I'd like to then (upon clicking a command button) have that textbox populate a listbox like so
comp1
comp2
comp3
comp4
Thanks for any help.
Re: Parse textbox to listbox - help
Let's assume that you do have "comp1,comp2,comp3,comp4"...the common element here is the "," between each entry.
So first we do dat = split(txtData,",") which splits the string above (assuming it's in txtData) into dat(0) to dat(3)
Now we need to add them to the list...that's a simple one too
VB Code:
for b=0 to ubound(dat())
lstDat.additem dat(b)
next b
That assumes the list is called lstDat. If that doesn't work, edit the "ubound(dat())" to say "ubound(dat)" (notice i changed dat() to dat...not sure which is right, I'm writing this outside of VB and haven't tested :-))
Re: Parse textbox to listbox - help
This worked. Problem solved.