请问VB当中当list1里的数字到list2中后按大小排列的代码该怎么写?
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/10/01 06:15:11
请问VB当中当list1里的数字到list2中后按大小排列的代码该怎么写?
如图所示,list1中的数字到list2中后按从小到大排列,然后在list1中加入新数字,左右互换后,两边的数字依然按从小到大排列.
Private Sub command1_click()
Dim a As Integer
a = 0
Do While a < List1.ListCount
If List1.Selected(a) = True Then List2.AddItem List1.List(a):List1.RemoveItem a Else a = a + 1
Loop
End Sub
Private Sub command2_click()
Dim a As Integer
a = List1.ListCount - 1
For i = 0 To a
List2.AddItem List1.List1(i)
Next i
List1.Clear
End Sub
Private Sub command3_click()
Dim a As Integer
a = 0
Do While a < List2.ListCount
If List2.Selected(a) = True Then List1.AddItem List2.List(a):List2.RemoveItem a Else a = a + 1
Loop
End Sub
Private Sub Command4_Click()
Dim a As Integer
a = List2.ListCount - 1
For i = 0 To a
List1.AddItem List2.List(i)
Next i
List2.Clear
End Sub
Private Sub form_load()
List1.Clear
List2.Clear
List1.AddItem "7"
List1.AddItem "18"
List1.AddItem "25"
List1.AddItem "13000"
List1.AddItem "2000"
List1.AddItem "50000"
List1.AddItem "299"
Command1.Caption = ">"
Command2.Caption = ">>"
Command3.Caption = "<"
Command4.Caption = "<<"
Command5.Caption = "从小到大排序"
Command6.Caption = "左右互换"
Label2.Caption = "数字一"
Label3.Caption = "数字二"
Label1.Caption = "按Shift或Ctrl键可以多选"
End Sub
这是我前面已经写好的代码,就是比大小的代码如何写不知道,
如图所示,list1中的数字到list2中后按从小到大排列,然后在list1中加入新数字,左右互换后,两边的数字依然按从小到大排列.
Private Sub command1_click()
Dim a As Integer
a = 0
Do While a < List1.ListCount
If List1.Selected(a) = True Then List2.AddItem List1.List(a):List1.RemoveItem a Else a = a + 1
Loop
End Sub
Private Sub command2_click()
Dim a As Integer
a = List1.ListCount - 1
For i = 0 To a
List2.AddItem List1.List1(i)
Next i
List1.Clear
End Sub
Private Sub command3_click()
Dim a As Integer
a = 0
Do While a < List2.ListCount
If List2.Selected(a) = True Then List1.AddItem List2.List(a):List2.RemoveItem a Else a = a + 1
Loop
End Sub
Private Sub Command4_Click()
Dim a As Integer
a = List2.ListCount - 1
For i = 0 To a
List1.AddItem List2.List(i)
Next i
List2.Clear
End Sub
Private Sub form_load()
List1.Clear
List2.Clear
List1.AddItem "7"
List1.AddItem "18"
List1.AddItem "25"
List1.AddItem "13000"
List1.AddItem "2000"
List1.AddItem "50000"
List1.AddItem "299"
Command1.Caption = ">"
Command2.Caption = ">>"
Command3.Caption = "<"
Command4.Caption = "<<"
Command5.Caption = "从小到大排序"
Command6.Caption = "左右互换"
Label2.Caption = "数字一"
Label3.Caption = "数字二"
Label1.Caption = "按Shift或Ctrl键可以多选"
End Sub
这是我前面已经写好的代码,就是比大小的代码如何写不知道,
在List2的属性中设置 Sorted 属性为 True 即可,这个属性是设置是否自动按字母顺序排列的属性.
请问VB当中当list1里的数字到list2中后按大小排列的代码该怎么写?
VB单击命令按钮,则文本框(text1)的英文句子按单词分解到列表框(list1),帮帮忙把代码补全(问号处)
VB随机产生10个10到100的整数,每行输出10个代码怎么写?
求E语言数字全排列的算法,用纯代码将一串数字进行大小排列
3*3的方格里有1-8八个数字和一个空格,通过移动可以使其按时针排序.这种游戏的vb代码应怎么写
求有数字按键的简单vb计算器代码,
vb中,怎么写代码,让程序能够识别我在text里写的一个数学公式,并且按照给定的值进行计算
在VB中不停产生随机数,直至有10个质数为止,将所有随机数输入LIST1,将10个质数输入LIST2中.
VB 100到200能被3或被5整除的数,每行输出10个数 代码要怎么写啊?
VB:产生20个30到50之间的随机数,并以每行4个进行排列.要求代码尽可能简洁易懂,
VB中,有1-39个数字,任意随机选择其中某些数字(数量不限)然后两两组合,请问用VB该怎么写程序?
把圆周率pi的精确度怎么能大到100000位(在vb上怎么写它的代码)