- Katılım
- 5 Ocak 2014
- Mesajlar
- 3,333
- Tepkime puanı
- 6
- Puanları
- 136
Bu dersimizde istediğiniz saat ve istediğiniz dakikadan başlatabileceğiniz bir geri sayım sayacı yapalım.
İlk önce forma 3 textbox, 1 command button, 1 timer ekledikten sonra aşağıdaki kodları giriyoruz:
Kod:
Private Sub Command1_Click()If Timer1.Enabled = True Then Timer1.Enabled = False Command1.Caption = "BAŞLA"Else If txsaat = "" Then txsaat = "00" If txdakika = "" Then txdakika = "00" If Len(txsaat) = 1 Then txsaat = "0" & txsaat If Len(txdakika) = 1 Then txdakika = "0" & txdakika If Len(txsaniye) = 1 Then txsaniye = "0" & txsaniye Timer1.Enabled = True Command1.Caption = "DURDUR"End IfEnd SubPrivate Sub Timer1_Timer()If txsaniye > 0 Then txsaniye = txsaniye - 1 If Len(txsaniye) = 1 Then txsaniye = "0" & txsaniyeElse txsaniye = 59 If txdakika > 0 Then txdakika = txdakika - 1 If Len(txdakika) = 1 Then txdakika = "0" & txdakika Else txdakika = 59 If txsaat > 0 Then txsaat = txsaat - 1 If Len(txsaat) = 1 Then txsaat = "0" & txsaat Else txsaat = "00": txsaniye = "00": txdakika = "00" MsgBox "Bitti" Timer1.Enabled = False End If End If End IfEnd Sub
İlk önce forma 3 textbox, 1 command button, 1 timer ekledikten sonra aşağıdaki kodları giriyoruz:
Kod:
Private Sub Command1_Click()If Timer1.Enabled = True Then Timer1.Enabled = False Command1.Caption = "BAŞLA"Else If txsaat = "" Then txsaat = "00" If txdakika = "" Then txdakika = "00" If Len(txsaat) = 1 Then txsaat = "0" & txsaat If Len(txdakika) = 1 Then txdakika = "0" & txdakika If Len(txsaniye) = 1 Then txsaniye = "0" & txsaniye Timer1.Enabled = True Command1.Caption = "DURDUR"End IfEnd SubPrivate Sub Timer1_Timer()If txsaniye > 0 Then txsaniye = txsaniye - 1 If Len(txsaniye) = 1 Then txsaniye = "0" & txsaniyeElse txsaniye = 59 If txdakika > 0 Then txdakika = txdakika - 1 If Len(txdakika) = 1 Then txdakika = "0" & txdakika Else txdakika = 59 If txsaat > 0 Then txsaat = txsaat - 1 If Len(txsaat) = 1 Then txsaat = "0" & txsaat Else txsaat = "00": txsaniye = "00": txdakika = "00" MsgBox "Bitti" Timer1.Enabled = False End If End If End IfEnd Sub