Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21089

general help sligtly stuck

$
0
0
i have a listbox1 and text1.text

list1 holds keywords

office books <<<<<<< when i click here it should automaticly select that and 5 lines below and add to text1.text with comma ,
plane tickets
colour pens
match box
pen drive
usb stick
flash drives
computer spare parts
hdd drives


example when selected ( office books )

text1.text = "office books,plane tickets,colour pens,match box,pen drive"



this is what i have

Code:

If List1.ListIndex = List1.ListCount - 1 Then
        List1.ListIndex = 0  ' <<< when it comes to selecting last item the other remaing items should get selected from top row again.
        Text1.Text = List1.Text & "," & List1.List(List1.ListIndex - 0 + 1) & "," & List1.List(List1.ListIndex - 0 + 2) & "," & List1.List(List1.ListIndex - 0 + 3) & "," & List1.List(List1.ListIndex - 0 + 4) & "," & List1.List(List1.ListIndex - 0 + 5)
    Else
      '  List1.ListIndex = List1.ListIndex + 1
      Text1.Text = List1.Text & "," & List1.List(List1.ListIndex - 0 + 1) & "," & List1.List(List1.ListIndex - 0 + 2) & "," & List1.List(List1.ListIndex - 0 + 3) & "," & List1.List(List1.ListIndex - 0 + 4) & "," & List1.List(List1.ListIndex - 0 + 5)
    End If
End Sub


==========================================

2nd thing how do i randomize the keywords before it goes to text1.text

add random 5 items from list1 to text1.text

Viewing all articles
Browse latest Browse all 21089

Trending Articles