列表框:将一个组合框添加为项目? [英] Listbox: add a combobox as Item?

查看:136
本文介绍了列表框:将一个组合框添加为项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使列表框的每个项目都作为组合框吗?
我需要这个,因为我使列表框可以查询,然后我需要使用户从列表的每个元素的不同选项中选择。

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.

谢谢

推荐答案

如果您不打算分发应用程序,那么您还可以查看TreeView控件。请参见此示例。

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

代码

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

使用控制

为了能够使用Treeview Control,您的系统必须具有 MSCOMCTL.OCX 注册。然后,您可以通过右键单击

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

< img src =https://i.stack.imgur.com/olUSY.pngalt =enter image description here>

设计时间快照

下载OCX

如果没有OCX,那么你可以下载来自此处

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

这篇关于列表框:将一个组合框添加为项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆