关于Combo控件,的一个大难题?

howto123 2004-11-30 09:23:07
我在Combo控件的list属性中加入了一些单词,

Combo控件的style属性设置为1,我想在Combo控件中输入一个单词,

就能够得到此单词在Combo控件中的indexlist属性的值,前提是不使用循环,

因为每次输入单词后,Combo控件会自动显示此单词,

并放到第一个位置,

目前我就是想得到此单词在Combo控件中的indexlist属性的值。
...全文
111 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
爽云 2004-11-30
  • 打赏
  • 举报
回复
把combo和数据库挂起来,这样只要在你输入时的控件的change或其它事件里用SQL语句取出数据来就可以了!
wwqna 2004-11-30
  • 打赏
  • 举报
回复
Private Sub Combo1_Change()
Dim sString As String
Dim start As Integer
start = Combo1.SelStart
sString = Left(Combo1.Text, start)
For i = 0 To Combo1.ListCount - 1 Step 1
Dim sitem As String
sitem = Combo1.List(i)
sitem = Left(sitem, start)
If sitem = sString Then
List1.ListIndex = i
List1.Visible = True
Exit For
End If
Next
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo1.ListIndex = List1.ListIndex
List1.Visible = False
End If
End Sub

Private Sub Form_Load()
Combo1.AddItem "abc"
Combo1.AddItem "acb"
Combo1.AddItem "edf"
Combo1.AddItem "ffff"
'向Combo1添加列表项

Dim i As Integer
For i = 0 To Combo1.ListCount - 1 Step 1
List1.AddItem Combo1.List(i), i
Next
List1.Visible = False
'向List1添加与Combo1相同的列表项
End Sub


用listbox摸拟一个,不用for怎么可能
行云边 2004-11-30
  • 打赏
  • 举报
回复
以前网上看到过一篇文章 ,使用windows 的一个dll提供的接口可以轻松实现 像 IE 地址栏的功能
xugangwujiao 2004-11-30
  • 打赏
  • 举报
回复
你再说清楚点嘛 我不是很懂你的意思
cosio 2004-11-30
  • 打赏
  • 举报
回复
意思是说和“金山词霸”那样子的功能了!
   不用for循环,那你想用什么?
pweixing 2004-11-30
  • 打赏
  • 举报
回复
"因为每次输入单词后,Combo控件会自动显示此单词,

并放到第一个位置,"

是什么意思????
不太懂楼主的意思!

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧