combo box 赋值

hanne 2003-05-31 12:04:01
combobox cbo1 的list里有 "aa" "bb" "cc", 怎样才能将"cc"社为选中状态?
(不要用cbo.listindex = 2)
...全文
49 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
footballboy 2003-05-31
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
Dim i As Long
Dim idx As Long

For i = 0 To Combo1.ListCount - 1
If Combo1.List(i) = "cc" Then
idx = i
Exit For
End If
Next
Combo1.ListIndex = idx
End Sub
hanne 2003-05-31
  • 打赏
  • 举报
回复
list 的内容是从数据库里取出来填充进去的,不知道index值怎么办?
myhot-河马吃草 2003-05-31
  • 打赏
  • 举报
回复
为什么不用cbo.listindex=2
bydisplay 2003-05-31
  • 打赏
  • 举报
回复
cbo1.text="cc"

7,785

社区成员

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

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