Dim somma As Double
Dim numero As Double
Dim risultato As Double
Dim cont As Integer
Private Sub Cmdmedia_Click()
somma = 0
numero = 0
cont = 0
If Txtita.Text <> "" And txtstoria.Text <> "" And Txtinglese.Text <> "" And Txtmat.Text <> "" And txtdiritto.Text <> "" And Txtsis.Text <> "" And Txtinf.Text <> "" And Txtcondotta.Text <> "" And Txtaprog.Text <> "" Then
If Val(Txtita.Text) < 6 Then
cont = cont + 1
End If
If Val(txtstoria.Text) < 6 Then
cont = cont + 1
End If
If Val(Txtinglese.Text) < 6 Then
cont = cont + 1
End If
If Val(txtdiritto.Text) < 6 Then
cont = cont + 1
End If
If Val(Txtmat.Text) < 6 Then
cont = cont + 1
End If
If Val(Txtsis.Text) < 6 Then
cont = cont + 1
End If
If Val(Txtinf.Text) < 6 Then
cont = cont + 1
End If
If Val(Txtaprog.Text) < 6 Then
cont = cont + 1
End If
If Val(Txtelet.Text) < 6 Then
cont = cont + 1
End If
If Txtita.Text <> "" Then
somma = somma + CDbl(Txtita.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di italiano!", vbInformation, "info"
End If
If txtstoria.Text <> "" Then
somma = somma + CDbl(txtstoria.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di storia!", vbInformation, "info"
End If
If Txtinglese.Text <> "" Then
somma = somma + CDbl(Txtinglese.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto d'inglese!", vbInformation, "info"
End If
If txtdiritto.Text <> "" Then
somma = somma + CDbl(txtdiritto.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di diritto!", vbInformation, "info"
End If
If Txtmat.Text <> "" Then
somma = somma + CDbl(Txtmat.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di matematica!", vbInformation, "info"
End If
If Txtelet.Text <> "" Then
somma = somma + CDbl(Txtelet.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di elettronica!", vbInformation, "info"
End If
If Txtinf.Text <> "" Then
somma = somma + CDbl(Txtinf.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di informatica!", vbInformation, "info"
End If
If Txtsis.Text <> "" Then
somma = somma + CDbl(Txtsis.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di sistemi!", vbInformation, "info"
End If
If Txtaprog.Text <> "" Then
somma = somma + CDbl(Txtaprog.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di Area Progetto", vbInformation, "info"
End If
If Txtcondotta.Text <> "" Then
somma = somma + CDbl(Txtcondotta.Text)
numero = numero + 1
Else
MsgBox "Devi mettere il voto di condotta!", vbInformation, "info"
End If
risultato = CDbl(somma / numero)
If cont >= 4 Then
Label27.Caption = "L'alunno è stato bocciato"
Label26.Caption = ""
Else
Label27.Caption = "L'alunno è stato promosso"
Label26.Caption = CDbl(risultato)
End If
End If
End Sub
Private Sub Command1_Click()
Cmdmedia.SetFocus
Txtita.Text = ""
txtstoria.Text = ""
Txtinglese.Text = ""
txtdiritto.Text = ""
Txtsis.Text = ""
Txtinf.Text = ""
Txtaprog.Text = ""
Txtcondotta.Text = ""
Txtelet.Text = ""
Txtmat.Text = ""
Label26.Caption = ""
Label27.Caption = ""
End Sub
Private Sub Form_DblClick()
Frmprincipale.WindowState = 2
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim ris As Integer
If KeyCode = 27 Then
ris = MsgBox("Sei sicuro di voler uscire?", vbInformation + vbYesNo, "Esci")
If ris = vbYes Then
MsgBox "BY ALBERT KING!!!(04\04\2006)", vbInformation, "Esci"
End
End If
End If
If KeyCode = 112 Then
frmaiuto.Show
End If
End Sub
Private Sub Form_Load()
somma = 0
numero = 0
cont = 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Sei sicuro di voler uscire?", vbInformation + vbYesNo, "Esci") = vbYes Then
MsgBox "BY ALBERT KING!!!", vbInformation, "Esci"
End
Else
Cancel = True
End If
End Sub
Private Sub mnucancella_Click()
Cmdmedia.SetFocus
Txtita.Text = ""
txtstoria.Text = ""
Txtinglese.Text = ""
txtdiritto.Text = ""
Txtsis.Text = ""
Txtinf.Text = ""
Txtaprog.Text = ""
Txtcondotta.Text = ""
Txtelet.Text = ""
Txtmat.Text = ""
Label26.Caption = ""
Label27.Caption = ""
End Sub
Private Sub mnuesci_Click()
Dim ris As Integer
ris = MsgBox("Sei sicuro di voler uscire?", vbInformation + vbYesNo, "Esci")
If ris = vbYes Then
MsgBox "BY ALBERT KING!!!(04\04\2006)", vbInformation, "Esci"
End
End If
End Sub
Private Sub Txtaprog_Change()
If IsNumeric(Txtaprog.Text) Then
If Val(Txtaprog.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtaprog.Text = ""
End If
Else
Txtaprog.Text = ""
End If
End Sub
Private Sub Txtaprog_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtaprog.Text = ""
End If
End Sub
Private Sub Txtcondotta_Change()
If IsNumeric(Txtcondotta.Text) = False Then
Txtcondotta.Text = ""
End If
End Sub
Private Sub Txtcondotta_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtcondotta.Text = ""
End If
End Sub
Private Sub txtdiritto_Change()
If IsNumeric(txtdiritto.Text) Then
If Val(txtdiritto.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
txtdiritto.Text = ""
End If
Else
txtdiritto.Text = ""
End If
End Sub
Private Sub txtdiritto_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
txtdiritto.Text = ""
End If
End Sub
Private Sub Txtelet_Change()
If IsNumeric(Txtelet.Text) Then
If Val(Txtelet.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtelet.Text = ""
End If
Else
Txtelet.Text = ""
End If
End Sub
Private Sub Txtelet_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtelet.Text = ""
End If
End Sub
Private Sub Txtinf_Change()
If IsNumeric(Txtinf.Text) Then
If Val(Txtinf.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtinf.Text = ""
End If
Else
Txtinf.Text = ""
End If
End Sub
Private Sub Txtinf_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtinf.Text = ""
End If
End Sub
Private Sub Txtinglese_Change()
If IsNumeric(Txtinglese.Text) Then
If Val(Txtinglese.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtinglese.Text = ""
End If
Else
Txtinglese.Text = ""
End If
End Sub
Private Sub Txtinglese_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtinglese.Text = ""
End If
End Sub
Private Sub Txtita_Change()
If IsNumeric(Txtita.Text) Then
If Val(Txtita.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtita.Text = ""
End If
Else
Txtita.Text = ""
End If
End Sub
Private Sub Txtita_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtita.Text = ""
End If
End Sub
Private Sub Txtmat_Change()
If IsNumeric(Txtmat.Text) Then
If Val(Txtmat.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtmat.Text = ""
End If
Else
Txtmat.Text = ""
End If
End Sub
Private Sub Txtmat_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtmat.Text = ""
End If
End Sub
Private Sub Txtsis_Change()
If IsNumeric(Txtsis.Text) Then
If Val(Txtsis.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
Txtsis.Text = ""
End If
Else
Txtsis.Text = ""
End If
End Sub
Private Sub Txtsis_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
Txtsis.Text = ""
End If
End Sub
Private Sub txtstoria_Change()
If IsNumeric(txtstoria.Text) Then
If Val(txtstoria.Text) > 10 Then
MsgBox "Numero troppo grande!!", vbInformation, "info"
txtstoria.Text = ""
End If
Else
txtstoria.Text = ""
End If
End Sub
Private Sub txtstoria_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 190 Then
MsgBox " Devi utilizzare la virgola!!!", vbInformation, "Esci"
txtstoria.Text = ""
End If
End Sub