Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listbox: add a combobox as Item?

Tags:

excel

vba

Is it possible to make every item of a listbox as a combobox? I need this because i made the listbox as checkable and then I need to make the user to choose from different options for every element of the list.

Thanks!

like image 690
Francesco Bonizzi Avatar asked Nov 22 '25 12:11

Francesco Bonizzi


1 Answers

If you are not planning on distributing your application then you can also look at the TreeView Control. See this example.

CODE

Private Sub CommandButton1_Click()
    With TreeView1.Nodes
        .Add , , "R1", "Root 1"
        .Add "R1", tvwChild, , "Test 1"
        .Add "R1", tvwChild, , "Test 2"
        .Add "R1", tvwChild, , "Test 3"
        .Add "R1", tvwChild, , "Test 4"
        .Add "R1", tvwChild, , "Test 5"

        .Add , , "R2", "Root 2"
        .Add "R2", tvwChild, , "Test 11"
        .Add "R2", tvwChild, , "Test 22"
        .Add "R2", tvwChild, , "Test 33"
        .Add "R2", tvwChild, , "Test 44"
        .Add "R2", tvwChild, , "Test 55"
    End With
End Sub

SNAPSHOT

enter image description here

USING THE CONTROL

To be able to use the Treeview Control, your system must have MSCOMCTL.OCX registered. You can then add the control by Right Clicking on the

SNAPSHOT

enter image description here

DESIGN TIME SNAPSHOT

enter image description here

DOWNLOAD THE OCX

If you do not have the OCX then you can download it from here

like image 87
Siddharth Rout Avatar answered Nov 25 '25 09:11

Siddharth Rout