Simpler Taschenrechner

    • VB6

      Simpler Taschenrechner

      Hallo,
      ich hab mal einen Taschenrechner in VB6.0 geschreiben. Er ist ganz einfach. Man gibt einen Wert in eine TextBox ein und bestimmt in einer ComboBox +-*.Das gibt man in eine andere TextBox einen Wertt ein und drückt auf den = Button.

      Man benötigt: 1Button(Command1), 2TextBoxen (Text1,Text2), 1 ComboBox (Combo1), 1Label(Label1)

      So muss man es anordnen:



      Und hier der Quelltext:

      Visual Basic-Quellcode

      1. Dim Ein1 As Integer
      2. Dim Ein2 As Integer
      3. Dim Aus As String
      4. Private Sub Command1_Click()
      5. If Combo1 = "+" Then
      6. Ein1 = Text1.Text
      7. Ein2 = Text2.Text
      8. Aus = Ein1 + Ein2
      9. Label1.Caption = Aus
      10. End If
      11. If Combo1 = "-" Then
      12. Ein1 = Text1.Text
      13. Ein2 = Text2.Text
      14. Aus = Ein1 - Ein2
      15. Label1.Caption = Aus
      16. End If
      17. If Combo1 = "*" Then
      18. Ein1 = Text1.Text
      19. Ein2 = Text2.Text
      20. Aus = Ein1 * Ein2
      21. Label1.Caption = Aus
      22. End If
      23. If Combo1 = "/" Then
      24. Ein1 = Text1.Text
      25. Ein2 = Text2.Text
      26. Aus = Ein1 / Ein2
      27. Label1.Caption = Aus
      28. End If
      29. End Sub
      30. Private Sub Form_Load()
      31. Combo1.AddItem "+"
      32. Combo1.AddItem "-"
      33. Combo1.AddItem "*"
      34. Combo1.AddItem "/"
      35. End Sub


      Update: Kann jetzt auch teilen.

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „VBnator“ ()