Private Function Token() As String
Dim Length As Byte
Length = 10
Dim Chars As Char() = New Char() {"a"c, "b"c, "c"c, "d"c, "e"c, "f"c, _
"g"c, "h"c, "i"c, "j"c, "k"c, "l"c, _
"m"c, "n"c, "o"c, "p"c, "q"c, "r"c, _
"s"c, "t"c, "u"c, "v"c, "w"c, "x"c, _
"y"c, "z"c, "A"c, "B"c, "C"c, "D"c, _
"E"c, "F"c, "G"c, "H"c, "I"c, "J"c, _
"K"c, "L"c, "M"c, "N"c, "O"c, "P"c, _
"Q"c, "R"c, "S"c, "T"c, "U"c, "V"c, _
"W"c, "X"c, "Y"c, "Z"c, "0"c, "1"c, _
"2"c, "3"c, "4"c, "5"c, "6"c, "7"c, _
"8"c, "9"c}
Dim [Str] As String = String.Empty
Dim Random As New Random()
For a As Byte = 0 To Length - 1
[Str] += Chars(Random.[Next](0, 61))
Next
Return ([Str])
End Function
txtpassword.Text =令牌()傳遞函數的值到一個文本框
在上述粗體線正確..它不工作太
和上述代碼用於生成應在文本框中會顯示用戶的隨機密碼,如果可能的話在標籤這是更advicable
你能解釋一下你的問題是什麼? – 2010-02-21 10:24:55
我建議改變變量'String'的名字;使用關鍵字的變量名是非常不好的做法... – 2010-02-21 10:25:48