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:
Update: Kann jetzt auch teilen.
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
- Dim Ein1 As Integer
- Dim Ein2 As Integer
- Dim Aus As String
- Private Sub Command1_Click()
- If Combo1 = "+" Then
- Ein1 = Text1.Text
- Ein2 = Text2.Text
- Aus = Ein1 + Ein2
- Label1.Caption = Aus
- End If
- If Combo1 = "-" Then
- Ein1 = Text1.Text
- Ein2 = Text2.Text
- Aus = Ein1 - Ein2
- Label1.Caption = Aus
- End If
- If Combo1 = "*" Then
- Ein1 = Text1.Text
- Ein2 = Text2.Text
- Aus = Ein1 * Ein2
- Label1.Caption = Aus
- End If
- If Combo1 = "/" Then
- Ein1 = Text1.Text
- Ein2 = Text2.Text
- Aus = Ein1 / Ein2
- Label1.Caption = Aus
- End If
- End Sub
- Private Sub Form_Load()
- Combo1.AddItem "+"
- Combo1.AddItem "-"
- Combo1.AddItem "*"
- Combo1.AddItem "/"
- End Sub
Update: Kann jetzt auch teilen.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „VBnator“ ()