Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Listbox's selected item???

mOskimOski Member Posts: 44
I'm wondering if their is a code that if let's say an item in list1 is selected then a label's caption will be equal to a text or something...

please help....

thanks...


Comments

  • dokken2dokken2 Member Posts: 532
    [code]
    Private Sub Command1_Click()
    'if listbox item selected, set label caption
    If Me.List1.ListIndex > -1 Then _
    Me.Label1.Caption = Me.List1.Text
    End Sub

    Private Sub Form_Load()
    'init listbox
    With Me.List1
    .AddItem "A"
    .AddItem "B"
    .AddItem "C"
    End With
    End Sub
    [/code]
  • mOskimOski Member Posts: 44
    : [code]:
    : Private Sub Command1_Click()
    : 'if listbox item selected, set label caption
    : If Me.List1.ListIndex > -1 Then _
    : Me.Label1.Caption = Me.List1.Text
    : End Sub
    :
    : Private Sub Form_Load()
    : 'init listbox
    : With Me.List1
    : .AddItem "A"
    : .AddItem "B"
    : .AddItem "C"
    : End With
    : End Sub


    thank you sOoOo mUch for the code!!! I really I appreciate it!!! (^_^)

    Moski
    : [/code]:

Sign In or Register to comment.