抽奖程序(用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
=
To
5
Label1(i)
=
Int(10
*
Rnd)
Select
Case
Label1(i).Caption
Case
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
=
【vb.net抽奖程序代码 vba抽奖程序】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源代码 , 抽奖程序,从100个人中抽取三等奖3个,二等奖2个 , 一等奖1个,每次抽奖不重复 。Public Sub Main()
Dim allLeft As New List(Of Integer)()
For i As Integer = 0 To 99
allLeft.Add(i + 1)
Next
Dim r As New Random()
Dim [next] As Integer
Dim level As String
For i As Integer = 0 To 5
[next] = r.[Next]() Mod allLeft.Count
If i3 Then
level = "Third"
ElseIf i5 Then
level = "Second"
Else
level = "First"
End If
Console.WriteLine(level" level prize is: "allLeft([next]).ToString())
allLeft.RemoveAt([next])
Next
End Sub
VB中可用的抽奖程序的代码Dim a(1 To 100) As String
Dim i As Integer, x As Integer
Const n = 3 'nvb.net抽奖程序代码的值可根据实际需要赋予不同vb.net抽奖程序代码的变量
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Randomize '初始化随机数生成器
a(1) = "富士康" '以此将n个人vb.net抽奖程序代码的姓名保存在数组a中
a(2) = "庞麦郎"
- redis连不上可能的原因 redis程序连接报错
- mysql的存储程序包括 mysql支持存储过程吗
- redis使用技巧 redis在程序中的使用
- redis过期策略六种 程序怎么redis过期
- 前端访问redis 程序怎么访问redis
- sql数据库打包 程序打包mysql数据
- redis应用开发 redis和微信小程序
- windows安装程序无法将windows配置为在此计算机上运行 windows安装mongodb
- 黑马程序员在线课程 黑马程序员redis课程
- 编译好的redis包 redis打包到程序里
