PRIVATE SUB TestSub(L1 AS LISTBOX,L2 AS LISTBOX)
Dim i, a As Integer
Dim str As String
a = L2.ListCount
Do While i <> a
If L2.Selected(i) Then
L1.AddItem L2.List(i)
L2.RemoveItem i
a = a - 1
i = i - 1
End If
L2.Refresh
i = i + 1
END SUB
在command2_clicK事件中 call testsub(L1,L2)
在command1_clicK事件中 call testsub(L2,L1)
Dim i, a As Integer
Dim str As String
a = L2.ListCount
Do While i <> a
If L2.Selected(i) Then
L1.AddItem L2.List(i)
L2.RemoveItem i
a = a - 1
i = i - 1
End If
L2.Refresh
i = i + 1
END SUB
在command2_clicK事件中 call testsub(L1,L2)
在command1_clicK事件中 call testsub(L2,L1)
解决方案 »
- API函数的困惑
- 公式应该怎么写!?并且要四舍五入!
- excel画的图考到word中出现问题。。
- 急,编译程序,提示找不到方法或数据成员
- 用VB如何打开局域网上其他计算机上的文件?
- vb更改系统日期格式问题!!!
- 有谁知道哪里有演示程序制作软件下载?
- 求助
- 版主帮帮我!!!!!!!我要自定义打印纸张的大小。在DataReport中???
- VB,Date型变量可不可以相互赋值
- 如何把下列小程序中的代码改成调用函数或过程的代码。
- to BrentIvan(Ivan)还有点问题,发出请求后得到一个页面,它是弹出一个窗口,不html代码写在了上面,这个弹出窗口怎么控制?也就是我想根据判断返回的html控制它的内容。请务必交交小弟!
这样吧。
Sub ItemMove(FormList As ListBox, ToList As ListBox)
Dim index As Long
index = 0
Do
If FormList.Selected(index) = True Then
ToList.AddItem FormList.List(index)
FormList.RemoveItem (index)
Else
index = index + 1
End If
Loop Until index = FormList.ListCount
End Sub
用的时候 call ItemMove(list1,list2)
这样啊。快把代码复制过去吧。