教师点名软件开发问题
答案:1 悬赏:20 手机版
解决时间 2021-12-28 13:32
- 提问者网友:不爱我么
- 2021-12-28 04:27
谁能提供一个VB语言的教师上课随机点名软件的源代码?最好有源程序和源代码。谢谢
最佳答案
- 五星知识达人网友:神的生死簿
- 2021-12-28 05:15
一个listbox 默认名字为list1
一个commandbutton 默认名字为command1
一个textbox 默认名字为text1
代码如下:
Public go As Boolean
Private Sub Command1_Click()
go = Not (go)
start
End Sub
Private Sub Form_Load()
'窗体加载时随机添加姓名和学号
Randomize
Dim Num As String
Dim Names As String
For i = 1 To 45
Num = Int((99999 - 11111 + 1) * Rnd + 11111) '学号范围 99999-11111
Names = Chr(Int((-13000 + 15000 + 1) * Rnd + -13000)) & Chr(Int((-13000 + 15000 + 1) * Rnd + -13000)) & Chr(Int((-13000 + 15000 + 1) * Rnd + -13000)) '随机生成字符作为名字
List1.AddItem Num & " " & Names
Next
go = False
End Sub
Sub start()
On Error Resume Next
If List1.ListCount = 0 Then Exit Sub
If go = False Then Exit Sub
Do While go = True
p = Int((0 + List1.ListCount) * Rnd)
Text1.Text = List1.List(p)
DoEvents
Loop
End Sub
一个commandbutton 默认名字为command1
一个textbox 默认名字为text1
代码如下:
Public go As Boolean
Private Sub Command1_Click()
go = Not (go)
start
End Sub
Private Sub Form_Load()
'窗体加载时随机添加姓名和学号
Randomize
Dim Num As String
Dim Names As String
For i = 1 To 45
Num = Int((99999 - 11111 + 1) * Rnd + 11111) '学号范围 99999-11111
Names = Chr(Int((-13000 + 15000 + 1) * Rnd + -13000)) & Chr(Int((-13000 + 15000 + 1) * Rnd + -13000)) & Chr(Int((-13000 + 15000 + 1) * Rnd + -13000)) '随机生成字符作为名字
List1.AddItem Num & " " & Names
Next
go = False
End Sub
Sub start()
On Error Resume Next
If List1.ListCount = 0 Then Exit Sub
If go = False Then Exit Sub
Do While go = True
p = Int((0 + List1.ListCount) * Rnd)
Text1.Text = List1.List(p)
DoEvents
Loop
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯