张无忌与黄衫女续 二:vb中可编辑的下拉框怎么做

来源:百度文库 编辑:中科新闻网 时间:2024/03/29 01:25:02
vb中可编辑的下拉框怎么做
即用combo控件要求combo.text里的内容可以直接在combo.text中输入达到combo.text中字段的增加

1,先建一个下拉框控件Combo1。

2,添加代码:

Private Sub Combo1_KeyPress(KeyAscii As Integer)
    If (KeyAscii = 13) Then
        Combo1.AddItem (Combo1.Text)
        Combo1.Text = ""
    End If
End Sub

3,在下拉框控件Combo1中输入内容,按回车时,将自动将输入的内容添加到下拉框控件Combo1中。

首先combo的Style属性得是0
然后加入代码
Private Sub combo_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
combo.AddItem(combo.text)
combo.text=""
End If
End Sub
以上代码实现的功能是
在combo里写入文字,然后回车后,自动将写的内容添加到自己的下拉菜单中

CboChoose.AddItem "C:\Program Files\Thunder Network\Thunder"
CboChoose.AddItem "D:\Program Files\Thunder Network\Thunder"