VB中怎样输出所有的排列组合情况
如题,怎么输出所有的排列组合的情况啊~用下面的编程运行~text中显示结果闪的很快,根本就看不清是哪些排列组合~如何改善?DimPwdAsStringFunctionNF...
如题,怎么输出所有的排列组合的情况啊~用下面的编程运行~text中显示结果闪的很快,根本就看不清是哪些排列组合~
如何改善?
Dim Pwd As String
Function NFormM(ByVal iStart As Integer, iEnd As Integer, Num As Integer, Optional Str As String)
Dim i As Integer
If Num = 0 Then
With Text1
.Text = Text1.Text & Str & vbNewLine
.SelStart = Len(.Text)
End With
Else
For i = iStart To iEnd
DoEvents
NFormM i + 1, iEnd, Num - 1, Str & Mid(Pwd, i, 1)
Next
End If
End Function
Private Sub Command1_Click()
Dim out(), i As Integer, s As String
Text1.Text = ""
NFormM 1, Len(Pwd), Val(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 1 To 12
.AddItem i
Pwd = Pwd & Chr(64 + i)
Next
Print Pwd
End With
End Sub
就是可以把所有的排列组合全部显示出来~ 展开
如何改善?
Dim Pwd As String
Function NFormM(ByVal iStart As Integer, iEnd As Integer, Num As Integer, Optional Str As String)
Dim i As Integer
If Num = 0 Then
With Text1
.Text = Text1.Text & Str & vbNewLine
.SelStart = Len(.Text)
End With
Else
For i = iStart To iEnd
DoEvents
NFormM i + 1, iEnd, Num - 1, Str & Mid(Pwd, i, 1)
Next
End If
End Function
Private Sub Command1_Click()
Dim out(), i As Integer, s As String
Text1.Text = ""
NFormM 1, Len(Pwd), Val(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 1 To 12
.AddItem i
Pwd = Pwd & Chr(64 + i)
Next
Print Pwd
End With
End Sub
就是可以把所有的排列组合全部显示出来~ 展开
2个回答
展开全部
你那是输出间隔的问题,还没等你看清楚下一行已经输出并覆盖了前一次的结果
你可以用timer控制输出间隔以让你看清滑则楚
还可以将text弄大一些,将结果一行一行的显示出来塌让早团雀
你可以用timer控制输出间隔以让你看清滑则楚
还可以将text弄大一些,将结果一行一行的显示出来塌让早团雀
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询