I have listbox. See the attach files.. I want to add comma and [ ] in the textbox
like this [Code], [N], [name] when I click the command button. how to do that?
Printable View
I have listbox. See the attach files.. I want to add comma and [ ] in the textbox
like this [Code], [N], [name] when I click the command button. how to do that?
The same as here except you should use comma (", ") instead of a new line (vbCrLf).
For comma, It ok... I would like to add the bracket [ ] and comma to be like this
[Code], [N], [name]
Do you want the same in one line?
or like
[code],
[N],
[name]
Yes, Same in one line.
ok in that case, it is very simple
loop thru the listbox and follow this principle
"[" & LstVal & "], "
till you reach the last item in the listbox and then use
"[" & LstVal & "]"
where "LstVal" is the value you will get when you loop theu the listbox...
Try it.. if you still don't get it, let me know, I will post the code...
Code:Dim n As Long
For n = 0 To List1.ListCount - 1
Text1.Text = Text1.Text & "[" & List1.List(n) & "]"
If n <> List1.ListCount - 1 Then Text1.Text = Text1.Text & ", "
Next n
nice one gavio