VB LISTBOX属性
additem 添加属性
listcount总记录数
listindex索引值
Private Sub Form_Load()
List1.AddItem "广东省广州市"
List1.AddItem "广东省河源市"
List1.AddItem "广东省惠州市"
List1.ListIndex = 0
End Sub
Private Sub LeftAll_Click()
Dim i As Integer
For i = 0 To List2.ListCount - 1
List1.AddItem List2.List(i)
Next
List2.Clear
List1.ListIndex = List1.NewIndex
End Sub
Private Sub LeftOne_Click()
Dim i As Integer
If List2.ListCount = 0 Then Exit Sub
List1.AddItem List2.Text
i = List2.ListIndex
List2.RemoveItem i
List1.ListIndex = List1.NewIndex
If List2.ListCount > 0 Then
If i > List2.ListCount - 1 Then
List2.ListIndex = i - 1
Else
List2.ListIndex = i
End If
End If
End Sub
Private Sub List1_dblclick()
RightOne_Click
End Sub
Private Sub List2_dblClick()
LeftOne_Click
End Sub
Private Sub RightOne_Click()
Dim i As Integer
If List1.ListCount = 0 Then Exit Sub
List2.AddItem List1.Text
i = List1.ListIndex
List1.RemoveItem List1.ListIndex
If List1.ListCount > 0 Then
If i > List1.ListCount - 1 Then
List1.ListIndex = i - 1
Else
List1.ListIndex = i
End If
End If
List2.ListIndex = List2.NewIndex
End Sub
Private Sub RightALL_Click()
Dim i As Integer
For i = 0 To List1.ListCount - 1
List2.AddItem List1.List(i)
Next
List1.Clear
List2.ListIndex = 0
End Sub
Private Sub Up_Click()
Dim Up As Integer
With List2
If .ListIndex < 0 Then Exit Sub
Up = .ListIndex
If Up = 0 Then Exit Sub '不能将第一个项目向上移动
.AddItem .Text, Up - 1 '向上移动项目
.RemoveItem Up + 1 '删除旧的项目
.Selected(Up - 1) = True '选择刚刚被移动的项目
End With
End Sub
Private Sub Down_Click()
Dim Down As Integer
With List2
If .ListIndex < 0 Then Exit Sub
Down = .ListIndex
If Down = .ListCount - 1 Then Exit Sub '不能将最后的项目向下移动
.AddItem .Text, Down + 2 '向下移动项目
.RemoveItem Down '删除旧的项目
.Selected(Down + 1) = True '选择刚刚被移动的项目
End With
End Sub
附有截图
先新建两个listbox一个命名为:list1和一个list2
和六个命令按钮,详细命名见上图即可。为左、右、全左、全右、上、下
VB LISTBOX属性的更多相关文章
- c#、vb 自动属性
vb示例: Public Property Name() As String = "Bob" 等效于 Private _name As String = "Bob&quo ...
- VB默认属性、动态数组、Range对象的默认属性的一点不成熟的想法
1.默认属性 VB6.0有默认属性的特性.当没有给对象指定具体的属性时,"默认属性"是VB6.0将使用的属性.在某些情形下,省略常用属性名,使代码更为精简. 因为CommandBu ...
- VB ListBox 添加横向滚动条
Private Declare Function SendMessage Lib "user32 " Alias "SendMessageA" (ByVal h ...
- vb sendmessage 详解1
SendMessage函数的常用消息及其应用(有点长,希望能对大家有所帮助)函数原型: Declare Function SendMessage Lib "user32" Alia ...
- listbox里面添加WrapPanel ,支持自适应换行
listbox大家都会用,如果要让它支持换行操作还必须加上 ListBox.ItemsPanel ItemsPanelTemplate toolkit:WrapPanel/ /ItemsPanelTe ...
- listbox控件使用
1. 属性列表: SelectionMode 组件中条目的选择类型,即多选(Multiple).单选(Single) Rows 列表框中显示总共多少行 Sel ...
- VB如何连接访问数据库Access
VB如何连接访问数据库Access 听语音 | 浏览:10675 | 更新:2015-05-05 11:26 | 标签:连接 access 1 2 3 4 5 6 7 分步阅读 VB即Visual B ...
- vba中ListBox控件的使用
给ListBox添加内容 If CheckBox8 = True Then---------------------------checkbox控件被选中 For i = 0 To ListBox1. ...
- SendMessage函数的常用消息及其应用大全
来源:http://www.360doc.com/content/09/0814/10/19147_4907488.shtml,非常全面的解释. 文本框控件通常用于输入和编辑文字.它属于标准 Wind ...
随机推荐
- centos 6.5安装VMware tools
系统描述:win7旗舰版64位系统+VMware Workstation10+CentOS6.5(win7系统上安装了VMware Workstation10虚拟化软件,在该虚拟化软件上安装了Cent ...
- Python threads synchronization: Locks, RLocks, Semaphores, Conditions, Events and Queues(Forwarding)
This article describes the Python threading synchronization mechanisms in details. We are going to s ...
- Complete list of APDU responses
https://www.eftlab.com.au/index.php/site-map/knowledge-base/118-apdu-response-list List of APDU resp ...
- Android File Hierarchy : System Structure Architecture Layout
Most of the Android user are using their Android phone just for calls, SMS, browsing and basic apps, ...
- startActivities的使用
和startActivity()类似,startActivities也是界面跳转,可是传入的intent是一个数组,也就是说是多个. 如果我传入的是两个intent: I1和I2.则调用startAc ...
- Vue2.1.7源码学习
原本文章的名字叫做<源码解析>,不过后来想想,还是用“源码学习”来的合适一点,在没有彻底掌握源码中的每一个字母之前,“解析”就有点标题党了.建议在看这篇文章之前,最好打开2.1.7的源码对 ...
- SQL Server 中添加表注释
今天在创建完表之后,发现没有办法给表添加注释说明,字段的注释可以在建表的时候就添加,上网查了一下使用SQL给表添加注释的方法,方法如下: -- 表加注释 EXEC sys.sp_addextended ...
- 线程系列06,通过CLR代码查看线程池及其线程
在"线程系列04,传递数据给线程,线程命名,线程异常处理,线程池"中,我们已经知道,每个进程都有一个线程池.可以通过TPL,ThreadPool.QueueUserWorkItem ...
- 【centOS】centos7 查看和关闭防火墙
查看防火墙状态 firewall-cmd --state running代表防火墙正在运行 停止firewall systemctl stop firewalld.service 禁止firewall ...
- python接口自动化26-参数关联和JSESSIONID(上个接口返回数据作为下个接口请求参数)
前言 参数关联是接口测试和性能测试最为重要的一个步骤,很多接口的请求参数是动态的,并且需要从上一个接口的返回值里面取出来,一般只能用一次就失效了. 最常见的案例就是网站的登录案例,很多网站的登录并不仅 ...