
设置奖卷号码位数,比如6位
Private Sub Command1_Click()
If Len(Text1Text) <> 6 Then MsgBox "奖卷号码错误!": Exit Sub
s = ""
For i = 0 To 5
s = Int((10) Rnd)
DoEvents
ss = ss & s
Next
Text2Text = ss
If Text2Text = Text1Text Then
Label1Caption = "恭喜,你中奖了"
Else
Label1Caption = "谢谢你的参与"
End If
End Sub
Private Sub Form_Load()
Text1Text = ""
Text2Text = ""
End Sub
窗体上一个文本框,一个按钮:
Option Explicit
Private Sub Command1_Click()
Dim n As Integer
Dim m As Integer
Dim x As Integer
n = 1234
m = 5678
Randomize
x = Int(Rnd (5678 - 1234 + 1) + 1234)
Do While x Mod 4 = 0
x = Int(Rnd (5678 - 1234 + 1) + 1234)
Loop
Text1Text = x
End Sub
Private Sub Command1_Click()
Randomize
Label1Caption = Fix(Rnd 10)
Label2Caption = Fix(Rnd 10)
Label3Caption = Fix(Rnd 10)
LabelshuziCaption = Fix(Rnd 10)
If Label1Caption = LabelshuziCaption Or
Label2Caption = LabelshuziCaption Or
Label3Caption =LabelshuziCaption Then
Image1Visible = True
Else
Image1Visible = False
End If
End Sub
注:此段代码可以实现自动选出三个号 Label1 Label2 Label3为选出的三个号
以上就是关于求高手编一下这个vb抽奖程序。全部的内容,包括:求高手编一下这个vb抽奖程序。、VB程序设计,随机抽奖,每次产生一个区间为n到m的中奖号码,并自动排、VB程序做随机抽奖等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)