VB中去除有重复数字的数组问题?
有6个文本输入框,每个文本框都能自由输入想要的数字(最多4个),然后单击按钮,输出6个文本框内的数的重新组合(6个框每框有1个数)。例如:文本框1输入:5,8,10文本框...
有6个文本输入框,每个文本框都能自由输入想要的数字(最多4个),然后单击按钮,输出6个文本框内的数的重新组合(6个框每框有1个数)。
例如:文本框1输入:5,8,10
文本框2输入:8,12,30,31
文本框3输入:13,20,23,28
文本框4输入:14,15,26,28
文本框5输入:16,23,28,49
文本框6输入:25,48,50
单击事件如下:Private Sub Command1_Click()
Dim a As Integer, b As Integer
Dim c As Integer, d As Integer
Dim e As Integer, f As Integer
Dim aa(1 To 6)
For a = 1 To 6
aa(a) = Split(Me("text" & a).Text, ",")
Next
For a = 0 To UBound(aa(1))
For b = 0 To UBound(aa(2))
For c = 0 To UBound(aa(3))
For d = 0 To UBound(aa(4))
For e = 0 To UBound(aa(5))
For f = 0 To UBound(aa(6))
List1.AddItem aa(1)(a) & " " & aa(2)(b) & " " & aa(3)(c) & " " & aa(4)(d) & " " & aa(5)(e) & " " & aa(6)(f)
Next
Next
Next
Next
Next
Next
End Sub
请问怎么改才能去掉诸如 8 8 13 14 16 25这种里面含有两个相同数字的数组。并且后面的数都大于前面的数。 展开
例如:文本框1输入:5,8,10
文本框2输入:8,12,30,31
文本框3输入:13,20,23,28
文本框4输入:14,15,26,28
文本框5输入:16,23,28,49
文本框6输入:25,48,50
单击事件如下:Private Sub Command1_Click()
Dim a As Integer, b As Integer
Dim c As Integer, d As Integer
Dim e As Integer, f As Integer
Dim aa(1 To 6)
For a = 1 To 6
aa(a) = Split(Me("text" & a).Text, ",")
Next
For a = 0 To UBound(aa(1))
For b = 0 To UBound(aa(2))
For c = 0 To UBound(aa(3))
For d = 0 To UBound(aa(4))
For e = 0 To UBound(aa(5))
For f = 0 To UBound(aa(6))
List1.AddItem aa(1)(a) & " " & aa(2)(b) & " " & aa(3)(c) & " " & aa(4)(d) & " " & aa(5)(e) & " " & aa(6)(f)
Next
Next
Next
Next
Next
Next
End Sub
请问怎么改才能去掉诸如 8 8 13 14 16 25这种里面含有两个相同数字的数组。并且后面的数都大于前面的数。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询