Option Explicit
Private Sub annu_Click()
If nul = 0 Then
Unload Form1
Unload Me
End
Else
Form2.Hide
Form1.Show
End If
End Sub
Private Sub filee_Click()
per.Enabled = True
sfo.Enabled = True
End Sub
Private Sub Form_Load()
nul = 0
giorni.Text = 0
orer.Text = 0
minuti.Text = 0
secondi.Text = 0
per.Enabled = False
sfo.Enabled = False
End Sub
Private Sub giorni_KeyPress(KeyAscii As Integer)
If KeyAscii = 48 Or KeyAscii = 49 Or KeyAscii = 50 Or KeyAscii = 51 Or KeyAscii = 52 _
Or KeyAscii = 53 Or KeyAscii = 54 Or KeyAscii = 55 Or KeyAscii = 56 Or KeyAscii = 57 Or KeyAscii = 8 Then
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub giorni_LostFocus()
If giorni.Text = "" Then giorni.Text = 0
End Sub
Private Sub minuti_KeyPress(KeyAscii As Integer)
If KeyAscii = 48 Or KeyAscii = 49 Or KeyAscii = 50 Or KeyAscii = 51 Or KeyAscii = 52 _
Or KeyAscii = 53 Or KeyAscii = 54 Or KeyAscii = 55 Or KeyAscii = 56 Or KeyAscii = 57 Or KeyAscii = 8 Then
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub minuti_LostFocus()
If minuti.Text = "" Then minuti.Text = 0
End Sub
Private Sub nada_Click()
per.Enabled = False
sfo.Enabled = False
End Sub
Private Sub ok_Click()
If giorni.Text = "" Or giorni.Text > 365 Or giorni.Text < 0 Then
MsgBox "Inserire un numero di gioni corretto", vbExclamation, App.Title
ElseIf orer.Text = "" Or orer.Text > 23 Or orer.Text < 0 Then
MsgBox "Inserire un numero di ore corrette", vbExclamation, App.Title
ElseIf minuti.Text = "" Or minuti.Text > 59 Or minuti.Text < 0 Then
MsgBox "Inserire un numero di minuti corretti", vbExclamation, App.Title
ElseIf secondi.Text = "" Or secondi.Text > 59 Or secondi.Text < 0 Then
MsgBox "Inserire un numero di secondi corretti", vbExclamation, App.Title
ElseIf giorni.Text = 0 And orer.Text = 0 And minuti.Text = 0 And secondi.Text = 0 Then
MsgBox "Inserire almeno un numero", vbExclamation, App.Title
ElseIf filee.Value = True And per.Text = "" Then
MsgBox "Selezionare un file da eseguire", vbExclamation, App.Title
Else
Form1.Timer1.Enabled = False
sec = secondi.Text
min = minuti.Text
ore = orer.Text
cron = giorni.Text
Form1.sec_t.Caption = sec
Form1.min_t.Caption = min
Form1.ore_t.Caption = ore
Form1.cron_t.Caption = cron
Call Controlla
az = 1
Form1.avv.Caption = "Avvia"
Form2.Hide
Form1.Show
End If
End Sub
Private Sub orer_KeyPress(KeyAscii As Integer)
If KeyAscii = 48 Or KeyAscii = 49 Or KeyAscii = 50 Or KeyAscii = 51 Or KeyAscii = 52 _
Or KeyAscii = 53 Or KeyAscii = 54 Or KeyAscii = 55 Or KeyAscii = 56 Or KeyAscii = 57 Or KeyAscii = 8 Then
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub orer_LostFocus()
If orer.Text = "" Then orer.Text = 0
End Sub
Private Sub riav_Click()
per.Enabled = False
sfo.Enabled = False
End Sub
Private Sub secondi_KeyPress(KeyAscii As Integer)
If KeyAscii = 48 Or KeyAscii = 49 Or KeyAscii = 50 Or KeyAscii = 51 Or KeyAscii = 52 _
Or KeyAscii = 53 Or KeyAscii = 54 Or KeyAscii = 55 Or KeyAscii = 56 Or KeyAscii = 57 Or KeyAscii = 8 Then
Else
KeyAscii = 0
Beep
End If
End Sub
Private Sub secondi_LostFocus()
If secondi.Text = "" Then secondi.Text = 0
End Sub
Private Sub sfo_Click()
Dialog.ShowOpen
filedir = Dialog.FileName
If filedir = "" Then
MsgBox "Non hai selezionato un file", vbExclamation, App.Title
Else
per.Text = filedir
End If
End Sub
Private Sub spegn_Click()
per.Enabled = False
sfo.Enabled = False
End Sub