請用vb6寫了一個程式
會有倒數十秒計時
並且詢問十秒後結束程式
如果不想要結束而繼續使用,
請按確定
(如果不按確定,會自動結束程式)
2006-05-05 06:05:30 · 1 個解答 · 發問者 strike 5 in 電腦與網際網路 ➔ 程式設計
你好
你的程式
我執行卻沒有任何反應
是不是程式中
只要加一個command, timer這兩個物件就可以了
謝謝
2006-05-06 02:36:21 · update #1
Public I%, F As Form, WithEvents Cm As CommandButton, WithEvents Tm As TimerPrivate Sub Cm_Click()Form1.Tm = FalseUnload MeEnd SubPrivate Sub Form_Activate()On Error Resume NextIf Caption = "訊息" Then Height = 2280: Width = 3780 Set Cm = Controls.Add("VB.CommandButton", "Cm") Cm.Height = 465: Cm.Width = 1155 Cm.Left = 1260: Cm.Top = 1320 Cm.Caption = "確定": Cm.Visible = TrueElse Height = 3800: Width = 5000 Set Tm = Controls.Add("VB.Timer", "Tm") If Err = 0 Then Caption = "倒數計時 : 15" Tm.Interval = 1000: Tm = True: I = 14 End IfEnd IfEnd SubPrivate Sub Tm_Timer()Caption = "倒數計時 : " & IIf I = 10 Then Set F = New Form1 F.Caption = "訊息" F.Show: F.CurrentX = 60: F.CurrentY = 660 F.Print "還有10秒後結束程式,若欲停止計時請按確定"ElseIf I > 0 And I < 10 Then F.Cls: F.CurrentX = 120: F.CurrentY = 660 F.Print "還有" & I & "秒後結束程式,若欲停止計時請按確定"ElseIf I = 0 Then EndEnd IfI = I - 1End Sub
2006-05-06 15:57:50 補充:
不用加任何物件,直接貼上就可,奇怪!我跑起來沒問題阿?你再試試看.
2006-05-05 15:39:49 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋