vb计算问题 两个按钮
text1里有abcdef(要求,把abcdef依次两两组合不重复,如ab ac ad ae af bc bd be bf 。。。。。
提交按钮后把结果输出到text2中。
text3中有mnop
提交按钮二,把text2中得到的组合,依次于text3中的每一位字母组合新的三位数字母。
输出到text4中(如abm abn abo abp acm acn aco acp.......)
这两个按钮的代码怎么写?
Private Sub Command1_Click()
Dim i, j As Integer
Text2 = ""
For i = 1 To Len(Text1) - 1
For j = i + 1 To Len(Text1)
Text2 = Text2 & Mid(Text1, i, 1) + Mid(Text1, j, 1) & " "
Next
Next
End Sub
Private Sub Command2_Click()
Dim i, j As Integer, a() As String
Text4 = ""
a = Split(Left(Text2, Len(Text2) - 1), " ")
For i = 0 To UBound(a)
For j = 1 To Len(Text3)
Text4 = Text4 & a(i) & Mid(Text3, j, 1) & " "
Next
Next
End Sub
Dim i, j As Integer
Text2 = ""
For i = 1 To Len(Text1) - 1
For j = i + 1 To Len(Text1)
Text2 = Text2 & Mid(Text1, i, 1) + Mid(Text1, j, 1) & " "
Next
Next
End Sub
Private Sub Command2_Click()
Dim i, j As Integer, a() As String
Text4 = ""
a = Split(Left(Text2, Len(Text2) - 1), " ")
For i = 0 To UBound(a)
For j = 1 To Len(Text3)
Text4 = Text4 & a(i) & Mid(Text3, j, 1) & " "
Next
Next
End Sub
温馨提示:答案为网友推荐,仅供参考