ListBox控件容纳数据数目超过int型后?

glsw6 2004-05-11 04:29:12
我用中ListBox控件放了3万多条数据,想通过别的控件控制ListBox中选择的条目,但发现当ListIndex属性超过int型后就不好用了,如下:
Private Sub text1_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case 38 '按下了”上“键
If list1.Visible Then
If list1.ListIndex > 0 Then
list1.ListIndex = list1.ListIndex - 1
End If
End If
KeyCode = 0
text1.Text = list1.List(list1.ListIndex)
Case 40 '按下了”下“键
If list1.Visible Then
If list1.ListIndex < list1.ListCount - 1 Then
list1.ListIndex = list1.ListIndex + 1
End If
End If
KeyCode = 0
text1.Text = list1.List(list1.ListIndex)
End Select
End Sub
运行时,前面的条目按"上"键好使,但所有按”下“键都不好用,请问有什么方法可以实现类似的功能?谢谢!
...全文
37 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangjianyou 2004-05-12
  • 打赏
  • 举报
回复
窗体上放一个DataGrid,然后放一个按钮在Text框旁边,当按下按钮时弹出DataGrid(当然要调整一下位置),将你的数据源和DataGrid绑定,双击DataGrid时将选中的记录放在Text框。实践证明这个肯定行。
glsw6 2004-05-12
  • 打赏
  • 举报
回复
有人知道?

1,453

社区成员

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

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