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 ...
随机推荐
- 模拟拖拽图片 碰撞检测 DOM 鼠标事件 闭包
<!doctype html><html lang="en"> <head> <meta charset="UTF-8" ...
- windows的磁盘操作之九——区分本地磁盘与移动硬盘
http://cutebunny.blog.51cto.com/301216/674443 最近碰到了个新问题,记录下来作为windows的磁盘操作那个系列的续篇吧. 一些时候我们的程序需要区分本地存 ...
- 算法:冒泡排序(Bubble Sort)、插入排序(Insertion Sort)和选择排序(Selection Sort)总结
背景 这两天温习了 5 中排序算法,之前也都看过它们的实现,因为没有深入分析的缘故,一直记不住谁是谁,本文就记录一下我学习的一些心得. 三种排序算法可以总结为如下: 都将数组分为已排序部分和未排序部分 ...
- Easing圆环动画
Easing圆环动画 效果 源码 https://github.com/YouXianMing/Animations // // CircleView.h // YXMWeather // // Cr ...
- winform禁用标题栏
protected override void WndProc(ref Message m) { if (m.Msg == 0x112) { switch ((int)m.WParam) { //禁止 ...
- [Mongo] 解决mongoose不支持条件操作符 $gt$gte:$lte$ne $in $all $not
reference : http://blog.sina.com.cn/s/blog_4df23d840100u25x.html 找到mongoose的安装目录 /usr/local/lib/node ...
- UT-Austin大学在Image search and large-scale retrieval方面的一系列papers
WhittleSearch: Interactive Image Search with Relative Attribute Feedback. A. Kovashka, D. Parikh, a ...
- 快速近似最近邻搜索库 FLANN - Fast Library for Approximate Nearest Neighbors
What is FLANN? FLANN is a library for performing fast approximate nearest neighbor searches in high ...
- MyBatis使用Collection查询多对多或一对多结果集bug
情况描述:当使用JOIN查询,如果SQL查询出来的记录不是按id列排序的,则生成的List结果会有问题 案例: 1) 数据库模型 简而言之一个Goods包含多个Goods_Img 2) Java Be ...
- Git教程之工作区和暂存区
工作区(Working Directory) 就是你在电脑里能看到的目录,比如我的learngit文件夹就是一个工作区: