VB6 ListBox控件. [英] VB6 ListBox Control.
本文介绍了VB6 ListBox控件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
VB6列表框控件.
我有两个ListBox,(list1和list2)
当我更改/移动list1的向下滚动/向上滚动时,我希望list2向下滚动/向上滚动与list1相同.
VB6 ListBox Control.
I have a two ListBox, (list1 and list2)
When I change/Move the scroll(down/up) of list1 I want the list2 to scroll down/up same with the list1.
推荐答案
我认为您可以处理更改但不能滚动.
例如,您有2个带有客户ID& ID的列表框.客户名称.下面的代码将基于其他列表框的选定项目选择该项目(我现在没有VB 6 :()
I think you can handle the change but not scroll.
For example you have 2 listboxes with Customer IDs & Customer Names. The below code will select the item based on selected item of other listbox(I don''t have VB 6 now :( )
Private Sub listboxID_Click()
listboxName.ListIndex = listboxID.ListIndex
End Sub
Private Sub listboxName_Click()
listboxID.ListIndex = listboxName.ListIndex
End Sub
AFAIK,您无法同步在两个列表框之间滚动,因为不支持滚动事件.您可以通过捕获Change事件来将选择设置为同时运行.
AFAIK you cannot synchronise the scrolling between two list boxes as there is no support for a scroll event. You can set the selections to run in tandem by catching the Change event.
请注意不要将事件彼此链接,否则您将陷入滚动事件的无限循环中. br/>
Be aware to not link events to each other or you will find yourself in an infinite loop on on scroll events.
Private Sub lstBox1_Scroll()
lstBox2.TopIndex = lstBox1.TopIndex
End Sub
问候
Regards
这篇关于VB6 ListBox控件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文