班級隨機點名程序


一、界面設計

對象名 屬性名 屬性值
Form1 Caption 隨機點名
Label2 Caption 班級人數
Label2 FontSize 12
Text1 Text 請輸入班級人數
Text1 FontSize 12
Label1 Caption ""
Label1 FontSize 72
Command1 Caption 點名
Command1 FontSize 12

 

二、程序代碼

Dim num As Integer  'num表示班級人數

Private Sub Command1_Click()
  num = Val(Text1.Text)
  If num <= 0 Then
    MsgBox ("請輸入班級人數")
  Else
    Randomize
    xh = Int((num * Rnd) + 1)
    Label1.Caption = Str(xh)
  End If
End Sub

Private Sub Text1_Click()
  Text1.Text = ""
End Sub

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM