『壹』 怎么用vb做一个抽奖小程序 在1-1000内随机抽取

Private Sub Command1_Click()
Label1 = ""
Label1 = 1 + Int(1000 * Rnd)

End Sub

『贰』 VB 抽奖小程序

完化楼上的,,可以摇人名,,不会出现重复,,不会出现空白
加一个LIST 和一个TIMER ,COMMAND

Dim a(30) As String
Private Sub Command1_Click()

If Command1.Caption = "开始" Then

a(1) = "姓名1"
a(2) = "姓名2"
a(3) = "姓名3"
a(4) = "姓名4"
a(5) = "姓名5"
a(6) = "姓名6"
a(7) = "姓名7"
a(8) = "姓名8"
a(9) = "姓名9"
a(10) = "姓名10"
a(11) = "姓名11"
a(12) = "姓名12"
a(13) = "姓名13"
a(14) = "姓名14"
a(15) = "姓名15"
a(16) = "姓名16"
a(17) = "姓名17"
a(18) = "姓名18"
a(19) = "姓名19"
a(20) = "姓名20"
a(21) = "姓名21"
a(22) = "姓名22"
a(23) = "姓名23"
a(24) = "姓名24"
a(25) = "姓名25"
a(26) = "姓名26"
a(27) = "姓名27"
a(28) = "姓名28"
a(29) = "姓名29"
a(30) = "姓名30"
Command1.Caption = "停止"
Timer1.Enabled = True
Timer1.Interval = 50

Else
Timer1.Enabled = False
Timer1.Interval = 0
Command1.Caption = "开始"
End If
End Sub

Private Sub Form_Load()
Command1.Caption = "开始"
End Sub

Private Sub Timer1_Timer()
List1.Clear
Dim b(7) As Double
For i = 1 To 7
Randomize
1
b(i) = Int(29 * Rnd + 1)
For j = 1 To i - 1
If b(i) = b(j) Then GoTo 1
Next j
List1.AddItem a(b(i))
Next i
End Sub

『叁』 vb 编写一个抽奖程序

command1用来随机抽取,text2显示
text1用来自己输入
command2用来判断
基本思想:假设连续有a位相同,经过验证如果为真则得出结果,如果为假,则假设a=a-1位相同……直到a=0
也可以自己输入text2数据来检验程序
这段程序不局限于7位数

Private Sub Command2_Click()
Dim a$, b$, i%, j%, k%
a = CStr(Text1)
b = CStr(Text2)
For i = Len(a) To 1 Step -1
For j = 1 To Len(a) - i + 1
If Mid(a, j, i) = Mid(b, j, i) Then
k = i
Exit For
End If
Next
If k <> 0 Then Exit For
Next
Print k, Mid(a, j, i)'输出相同位数和相同数字
If len(a)+1-k>5 Then
MsgBox "对不起,无奖项"
Else
MsgBox Len(a) + 1 - k & "等奖"'判断奖项
End If
End Sub

Private Sub Command1_Click()
a = CStr(Text1)
Text2 = 10 ^ (Len(a) - 1) + Int(Rnd * 0.9 * 10 ^ Len(a))
End Sub

『肆』 vb6.0简单抽奖程序

预先将图片名改为1.jpg~10.jpg,放在程序同一文件夹中。
Private Sub Command1_Click() '抽奖
Timer1.Enabled = True
End Sub

Private Sub Command2_Click() ‘停止
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
Static i As Integer
i = i + 1
If i > 10 Then i = 1 ‘假设共回10个图片,如图片个数答更改,请相应更改数字
Image1.Picture = LoadPicture(i & ".jpg")
End Sub

『伍』 VB中可用的抽奖程序的代码

我知道你的意思:是不是每组数字来回滚动,随即组合。
停止时,组合成一组数字,并以这组数字作为中奖号码。
建立一个按钮:command1
private
sub
command1_click()
dim
a
as
integer
dim
b
as
integer
dim
c
as
integer
'a
b
c
为随机变量
dim
abc
as
string
'abc为组合号码
a
=
int(rnd
*
9)
+
1
b
=
int(rnd
*
9)
+
1
c
=
int(rnd
*
9)
+
1
abc=a
&
b
&
c
'组合中奖号码
'假设3到10等奖为003,004......,010
if
a
=
001
then
msgbox
"你中了1等奖!",
vbokonly,
"系统提示"
end
if
if
a
=
002
then
msgbox
"你中了2等奖!",
vbokonly,
"系统提示"
end
if
......
......
if
a
=
010
then
msgbox
"你中了10等奖!",
vbokonly,
"系统提示"
end
if
end
sub
ok...

『陆』 抽奖程序(用vb编写)

在窗体上添加一个command1,一个timer1,label1(0~5)
控件数组(添加一个label1,然后再复制5个,共6个,用来显示数字),代码如下:
Private
Sub
Command1_Click()
If
Command1.Caption
=
"抽奖"
Then
Command1.Caption
=
"停止"
Timer1.Enabled
=
True
Else
Timer1.Enabled
=
False
Command1.Caption
=
"抽奖"
End
If
End
Sub
Private
Sub
Form_Load()
Command1.Caption
=
"抽奖"
Timer1.Interval
=
50
Timer1.Enabled
=
False
End
Sub
Private
Sub
Timer1_Timer()
Randomize
For
i
=
0
To
5
Label1(i)
=
Int(10
*
Rnd)
Select
Case
Label1(i).Caption
Case
0
Label1(i).BackColor
=
RGB(0,
0,
0)
Label1(i).ForeColor
=
RGB(255,
255,
255)
Case
1
Label1(i).BackColor
=
RGB(128,
42,
42)
Label1(i).ForeColor
=
RGB(127,
213,
213)
Case
2
Label1(i).BackColor
=
RGB(255,
0,
0)
Label1(i).ForeColor
=
RGB(0,
255,
255)
Case
3
Label1(i).BackColor
=
RGB(255,
97,
0)
Label1(i).ForeColor
=
RGB(0,
158,
255)
Case
4
Label1(i).BackColor
=
RGB(255,
255,
0)
Label1(i).ForeColor
=
RGB(0,
0,
255)
Case
5
Label1(i).BackColor
=
RGB(0,
255,
0)
Label1(i).ForeColor
=
RGB(255,
0,
255)
Case
6
Label1(i).BackColor
=
RGB(0,
0,
255)
Label1(i).ForeColor
=
RGB(255,
0,
0)
Case
7
Label1(i).BackColor
=
RGB(160,
32,
240)
Label1(i).ForeColor
=
RGB(95,
223,
15)
Case
8
Label1(i).BackColor
=
RGB(192,
192,
192)
Label1(i).ForeColor
=
RGB(63,
63,
63)
Case
9
Label1(i).BackColor
=
RGB(255,
255,
255)
Label1(i).ForeColor
=
RGB(0,
0,
0)
End
Select
Next
End
Sub

『柒』 VB编写一个抽奖小程序,要求每次抽奖的数字不重复

DimnAsInteger
Dima()
PrivateSubCommand1_Click()
Ifn=0Then'第一次点击时执行
m=Val(Text1)
ReDima(1Tom)
Fori=1Tom'生成数组a,元素为至m这m个数
a(i)=i
Next
Fori=1Tom-1'随机打乱数组a中元素
r=Int(Rnd*m+1)
tmp=a(i)
a(i)=a(r)
a(r)=tmp
Next
EndIf
n=n+1'计数点击次数
Ifn>Val(Text1)Then'次数超过指定次数,抽奖结束
MsgBox"抽奖结束!"
ExitSub
EndIf
Text2=a(n)'从数组中抽出第n个数,由于数组中是随机排列,所以相当于生成一个随机数,并且不会重复
EndSub

『捌』 怎么用vb做一个抽奖程序

只要在窗体中做二个命令按钮、一个标签和一个定时器对象,复制以下代码,就可回以运行了:
Private Sub Command1_Click()
If Command1.Caption = "开始答" Then
Command1.Caption = "暂停"
Timer1.Enabled = True
Else
Command1.Caption = "开始"
Timer1.Enabled = False
End If
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Label1.Caption = ""
Label1.FontSize = 50
Timer1.Interval = 50
Timer1.Enabled = False
Command1.Caption = "开始"
Command2.Caption = "结束"
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Int(Rnd * 50) + 1
End Sub

『玖』 vb抽奖程序

Dim LL%, UU%
Dim zjHm$
Dim Sorted As Boolean

Private Sub Command1_Click()
On Error GoTo mEnd
If Sorted = True Then Label2.Caption = "": zjHm = "": Sorted = False
Select Case Command1.Caption
Case "开始"
LL=1
UU=10
Command1.Caption = "停止"
Timer1.Interval = 50
Timer1.Enabled = True
Call Timer1_Timer
Case "停止"
Timer1.Enabled = False
Command1.Caption = "开始"
zjHm = zjHm & Label1.Caption & " "
Label2.Caption = zjHm
End Select
mEnd:
End Sub

按钮的Caption应为专 开始,这个是判断属按钮名称来决定动作的

『拾』 VB抽奖程序

才子是不是可以点赞我了。。。。