Results 1 to 3 of 3

Thread: Select 1 rendom item from listbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    84

    Select 1 rendom item from listbox

    say if my textbox has X item how do i select 1 item from listbox?

  2. #2
    Banned
    Join Date
    Mar 2009
    Posts
    87

    Re: Select 1 rendom item from listbox

    this is a snippet from a project of mine
    Code:
    Dim A As Integer
    Dim B As Integer
    Dim C As Integer
    A = Combo1.ListCount
    B = Combo2.ListCount
    C = Combo3.ListCount
    Dim AX As Integer
    Dim AY As Integer
    Dim AZ As Integer
    AX = Int(Rnd() * A)
    AY = Int(Rnd() * B)
    AZ = Int(Rnd() * C)
    G1 = Combo1.List(AX)
    G2 = Combo2.List(AY)
    G3 = Combo3.List(AZ)
    just change combo1 to list1
    and take out all the extra stuff
    G1 is a textbox by the way.

  3. #3
    Addicted Member
    Join Date
    May 2007
    Location
    Belgium
    Posts
    156

    Re: Select 1 rendom item from listbox

    Code:
    Dim A as integer
    A = rnd * list1.listcount
    text1.text = list1.list(A)
    Should pretty much do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width