用VB将列表框List1与列表框List2中个表项合并到List3,List1,List2原有各表项已按ASCII码从大到小排好。
展开全部
Private Sub Command1_Click()
Dim a() As String, n As Integer
n = -1
For i = 0 To List1.ListCount - 1
n = n + 1
ReDim Preserve a(n)
a(n) = List1.List(i)
Next
For i = 0 To List2.ListCount - 1
n = n + 1
ReDim Preserve a(n)
a(n) = List2.List(i)
Next
For i = 0 To n
For j = 0 To i
If a(i) > a(j) Then
t = a(i): a(i) = a(j): a(j) = t
End If
Next
Next
For i = 0 To n
List3.AddItem a(i)
Next
End Sub
追问
19,20俩个Next是什么意思?
追答
省略写法,19是 Next j ,20是 Next i
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询