如果使VB中里text控件产生随机数据
假如有两个控件text1.texttext2.text怎么样才能让TEXT1里随机产生24个字母,TEXT2怎么才能随机产生邮箱如ttddc@tom.comdfjkvc@...
假如有两个控件 text1.text text2.text
怎么样才能让TEXT1里随机产生24个字母,TEXT2怎么才能随机产生邮箱 如 ttddc@tom.com dfjkvc@qq.com
有会的前辈帮忙写下代码吧 ,感激不尽!!! 展开
怎么样才能让TEXT1里随机产生24个字母,TEXT2怎么才能随机产生邮箱 如 ttddc@tom.com dfjkvc@qq.com
有会的前辈帮忙写下代码吧 ,感激不尽!!! 展开
2个回答
展开全部
Private Sub Form_Load()
Randomize
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Dim letter() As String
letter() = Split("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z", "|")
Dim i As Integer
For i = 1 To 24
Text1.Text = Text1.Text + letter(Int(Rnd() * 25))
Next
Text2.Text = Text1.Text & "@qq.com"
End Sub
Randomize
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Dim letter() As String
letter() = Split("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z", "|")
Dim i As Integer
For i = 1 To 24
Text1.Text = Text1.Text + letter(Int(Rnd() * 25))
Next
Text2.Text = Text1.Text & "@qq.com"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim s As Integer
Randomize
s = Int((Rnd * 7) + 4) '油箱名长度4-10
Text1 = ""
For i = 1 To s
Text1 = Text1 & Chr(Int(Rnd * 26) + 65) '26个字母
Next i
Text2 = Text1 & "@163.com"
End Sub
Dim s As Integer
Randomize
s = Int((Rnd * 7) + 4) '油箱名长度4-10
Text1 = ""
For i = 1 To s
Text1 = Text1 & Chr(Int(Rnd * 26) + 65) '26个字母
Next i
Text2 = Text1 & "@163.com"
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询