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!
谢谢!
2 个解决方案
#1
5
If you are not planning on distributing your application then you can also look at the TreeView Control. See this example.
如果您不打算分发应用程序,那么您还可以查看TreeView控件。看这个例子。
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
快照
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
为了能够使用Treeview控件,您的系统必须已注册MSCOMCTL.OCX。然后,您可以通过右键单击添加控件
SNAPSHOT
快照
DESIGN TIME SNAPSHOT
设计时间快照
DOWNLOAD THE OCX
下载OCX
If you do not have the OCX then you can download it from here
如果您没有OCX,那么您可以从这里下载
#2
3
You could achieve such an effect by replacing you listbox by a subform in datasheet view.
You will have the mimic the multiselect by providing a checkbox, and you could have a second column as a listbox.
您可以通过在数据表视图中将子列表替换为列表来实现此类效果。您将通过提供一个复选框来模拟多选,您可以将第二列作为列表框。
#1
5
If you are not planning on distributing your application then you can also look at the TreeView Control. See this example.
如果您不打算分发应用程序,那么您还可以查看TreeView控件。看这个例子。
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
快照
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
为了能够使用Treeview控件,您的系统必须已注册MSCOMCTL.OCX。然后,您可以通过右键单击添加控件
SNAPSHOT
快照
DESIGN TIME SNAPSHOT
设计时间快照
DOWNLOAD THE OCX
下载OCX
If you do not have the OCX then you can download it from here
如果您没有OCX,那么您可以从这里下载
#2
3
You could achieve such an effect by replacing you listbox by a subform in datasheet view.
You will have the mimic the multiselect by providing a checkbox, and you could have a second column as a listbox.
您可以通过在数据表视图中将子列表替换为列表来实现此类效果。您将通过提供一个复选框来模拟多选,您可以将第二列作为列表框。