VB 怎么将文本框1里的多个数值赋给数组,并排序后显示在文本框2中
2个回答
展开全部
文本框里的多个数值用逗号隔开:
Dim a() As String
a = Split(Text1.Text, ",")
注意,数组a是字符串类型,如果要进一步处理,假设是整数类型:
Dim a() As String, b() As Integer, i, n
a = Split(Text1.Text, ",")
n = -1
For i = 0 To UBound(a)
If IsNumeric(a) Then
n = n + 1
ReDim Preserve b(n)
b(n) = a(i)
End If
Next i
Dim a() As String
a = Split(Text1.Text, ",")
注意,数组a是字符串类型,如果要进一步处理,假设是整数类型:
Dim a() As String, b() As Integer, i, n
a = Split(Text1.Text, ",")
n = -1
For i = 0 To UBound(a)
If IsNumeric(a) Then
n = n + 1
ReDim Preserve b(n)
b(n) = a(i)
End If
Next i
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询