Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If chiffre1.Text = "" Or op.Text = "" Or chiffre2.Text = "" Then
MsgBox("Un champ obligatoire doit etre renseigné")
Exit Sub
Else
If (chiffre1.Text = "0" Or chiffre2.Text = "0") And (op.Text = "/" Or op.Text = "*") Then
MsgBox("Le 0 est interdit dans ce type d'opération")
Exit Sub
'ElseIf (chiffre1.Text = "0" Or chiffre2.Text = "0") And op.Text = "*" Then
' MsgBox("multiplication par 0 interdite")
' Exit Sub
Else
Select Case op.Text
Case "+" 'Print a short report
resultat.Text = (CInt(chiffre1.Text) + CInt(chiffre2.Text)).ToString
Case "-" 'Print a long, detailed report
resultat.Text = (CInt(chiffre1.Text) - CInt(chiffre2.Text)).ToString
Case "/" 'Graph the output
resultat.Text = (CInt(chiffre1.Text) / CInt(chiffre2.Text)).ToString
Case "*" 'Graph the output
resultat.Text = (CInt(chiffre1.Text) * CInt(chiffre2.Text)).ToString
Case Else 'All other cases or values of iswitch are an error
MsgBox("On me la fait pas hein...")
End Select
End If
'resultat.Text = (CInt(chiffre1.Text) CInt(op.Text) CInt(chiffre2.Text)).ToString
End If
End Sub