vb 排列组合
文本框1的字符若干个,用逗号隔开.举例:(不一定是连续的,我只是举个例子)1,2,3,4,5,6,7,8,9,10,11,点击按钮,文本框2列出选择其中3个的排列组合,不...
文本框1的字符若干个,用逗号隔开.
举例:(不一定是连续的,我只是举个例子)
1,2,3,4,5,6,7,8,9,10,11,
点击按钮,文本框2列出选择其中3个的排列组合,不重复.
1,2,3,
1,2,4,
省略 展开
举例:(不一定是连续的,我只是举个例子)
1,2,3,4,5,6,7,8,9,10,11,
点击按钮,文本框2列出选择其中3个的排列组合,不重复.
1,2,3,
1,2,4,
省略 展开
展开全部
你试试这个:
Private Sub Command1_Click()
Dim a
temp = ","
a = Split(Trim(Text1.Text), temp)
n = UBound(a)
If Trim(a(UBound(a))) = "" Then n = UBound(a) - 1
Text2.Text = ""
For i = 0 To n - 2
For j = i + 1 To n - 1
For k = j + 1 To n
Text2.Text = Text2.Text & a(i) & temp & a(j) & temp & a(k) & temp & vbCrLf
Next k
Next j
Next i
End Sub
Private Sub Command1_Click()
Dim a
temp = ","
a = Split(Trim(Text1.Text), temp)
n = UBound(a)
If Trim(a(UBound(a))) = "" Then n = UBound(a) - 1
Text2.Text = ""
For i = 0 To n - 2
For j = i + 1 To n - 1
For k = j + 1 To n
Text2.Text = Text2.Text & a(i) & temp & a(j) & temp & a(k) & temp & vbCrLf
Next k
Next j
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询