check style listbox
i have a project at the moment that has a checkstyle listbox in it , and i have the following code on the List1_click sub routine
Private Sub List1_Click()
text1 = ""
text1 = list1
end sub
how would i tell it to only enter the checked selection to go into the textbox rather than any click on the listbox
any help is always appreciated
thanks in advance
Rob
[404 byte] By [
Spumbu1977] at [2007-11-11 8:14:04]

# 1 Re: check style listbox
Dim a as long
For a = 0 To List1.ListCount - 1
If List1.Selected(a) = True Then
Text1.text= List1.List(a)
End If
Next
Of course this will put all selected items into the textbox and you will only see the last. But you now have something you can work on.
Steve.
# 2 Re: check style listbox
how would i clear the selected(a) after i have made a choice because with that code ats it is now makes up an array of some sort and when i click on one it enters it into the textbox and then when i click on another it adds the first one and the second one together so after i have selected number two i now have three in my textbox since it stores them somewhere
please help
many thanks
# 3 Re: check style listbox
Spumbo,
I think you need to be clearer with what you are trying to achieve.
In your first post you state you are using a Check Listbox, the implication here is that your users can select more than one item at a time. I showed you a very easy way to iterate through the items looking for selected ones only. Every item selected is popped into your textbox and then replaced by the next, you would only ever see the last one. I hoped this would give you food for thought.
In your last post, you ask how we can clear the selections as we go, this implies that a Check LIstbox is not what we want.
I suspect that I have misunderstood your requirements, there is no array involved in my example. Please state clearly what you want and I will help you.
Steve.