Results 1 to 3 of 3

Thread: reading the combo list

  1. #1

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    reading the combo list

    VB Code:
    1. Private Sub Form_Load()
    2.  Randomize Timer
    3.  lblrandom.Caption = Int(Rnd * 3)
    4.  lbltemp.Caption = Combo1.List(lblrandom.Caption)
    5. End Sub

    I have this code and I have loaded into combo1 a textfile.But this doesn't get anything into lbltemp.caption.Any ideas?I know it has 4 entries so I put 3.Can I generalize it by multiptying by como1.listcount or something?

    Thanks in advance


    Has someone helped you? Then you can Rate their helpful post.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    VB Code:
    1. Private Sub Form_Load()
    2.     '' fill with some values
    3.     ''
    4.     Dim i As Long: For i = 0 To 4: Combo1.AddItem i: Next
    5.    
    6.     '' now select a random entry
    7.     ''
    8.     Randomize
    9.     Combo1.Text = Combo1.List(Combo1.ListCount * Rnd)
    10. End Sub

  3. #3

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    I can't get it!If I put your code under a command button it works.If I have it under the form load, it doesn't work. If I "call" the command1_click in the form_load it doesn't work again! Any other ideas???


    Has someone helped you? Then you can Rate their helpful post.

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