custom listbox help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joemo2003
    New Member
    • Feb 2007
    • 142

    #1

    custom listbox help

    I just a VB beginner.
    I try to creat a custom listbox with a list of temperture units by VBA, but my code didn't do anything when i click the run bottom. The units didn't show up on the listbox. could any body help me out.

    Code:
    Sub ListBox1_Click()
    With SampleDialogBox.ListBox1
        .RowSource = ""
        .AddItem "C"
        .AddItem "F"
        .AddItem "R"
        End With
    End sub
    Thanks a lot
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    The code you posted is written in the Click event procedure for the listbox. That means it will be run when you click one of the values in the listbox. Somehow, I don't think this is likely to happen, if there aren't any values there. :)

    You need to place your code somewhere it will actually be executed. For example, in the Form_Load procedure, which is executed once as the form is loaded.

    Comment

    Working...