回覆列表
-
1 # 使用者6752233332401
-
2 # 使用者8451710051916
程式碼如下:
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Click()
Label1.Caption = "快樂、輕鬆學Visual Basic"
End Sub
Private Sub Form_Load()
Label1.Caption = ""
End Sub
做二個窗體,每個窗體中各做一個文字框、一個定時器控制元件。FORM1的程式碼:Private Sub Form_Load()Text1 = "60.00 Sec"Timer1.Interval = 10End SubPrivate Sub Timer1_Timer()Static nStatic mIf m = 0 Then m = 1: n = 6000n = n - 1t = n Mod 100If t > 9 Thens = n \ 100 & "." & t & " Sec"Elses = n \ 100 & ".0" & t & " Sec"End IfText1 = sIf n = 0 Thenn = 6000Form2.ShowUnload MeEnd IfEnd Sub第二個窗體的程式碼:Private Sub Form_Load()Text1 = "60.00 Sec"Timer1.Interval = 10End SubPrivate Sub Timer1_Timer()Static nStatic mIf m = 0 Then m = 1: n = 6000n = n - 1t = n Mod 100If t > 9 Thens = n \ 100 & "." & t & " Sec"Elses = n \ 100 & ".0" & t & " Sec"End IfText1 = sIf n = 0 Thenn = 6000Form1.ShowUnload MeEnd IfEnd Sub