'Commande de calcul du résultat Private Sub cmdCalculer_Click() If (Not IsNumeric(txt01)) Or (Not IsNumeric(txt02)) Then MsgBox "Valeur non numerique!", vbCritical Else If OptAddition.Value = True Then lblAffichage.Caption = CStr(CDbl(txt01.Text) + CDbl(txt02.Text)) End If If optSoustraction.Value = True Then lblAffichage.Caption = CStr(CDbl(txt01.Text) - CDbl(txt02.Text)) End If If ((optDivisionEntiere.Value = True) And (CDbl(txt02.Text) <> 0)) Then lblAffichage.Caption = CStr(CDbl(txt01.Text) \ CDbl(txt02.Text)) End If If ((optDivisionEntiere.Value True) And (CDbl(txt02.Text) 0)) Then MsgBox "Cette opértation est impossible!!!", vbCritical End If If optModulo.Value = True Then lblAffichage.Caption = CStr(CDbl(txt01.Text) Mod CDbl(txt02.Text)) End If If optMultiplication.Value = True Then lblAffichage.Caption = CStr(CDbl(txt01.Text) * CDbl(txt02.Text)) End If End If End Sub ' Commande pour quitter Private Sub cmdQuitter_Click() End End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question'Commande de calcul du résultat Private Sub cmdCalculer_Click() Dim resultat As Double 'optionbutton d'addition If OptAddition.Value = True Then resultat = valeur1 + valeur2 End If End Sub ' Commande pour quitter Private Sub cmdQuitter_Click() End End Sub ' Label dans lequel doit s'afficher le résultat Private Sub lblAfficher_Change() Dim affichage_resultat As String affichage_resultat = CStr(resultat) End Sub ' Textbox n°1 dans lequel l'utilisateur rentre les chiffres Private Sub text1_Change() Dim Texte1 As String Dim valeur1 As Double Texte1 = text1.Text valeur1 = CDbl(Texte1) End Sub ' Textbox n°2 dans lequel l'utilisateur rentre les chiffres Private Sub text2_Change() Dim Texte2 As String Dim valeur2 As Double Texte2 = text2.Text valeur2 = CDbl(Texte2) End Sub