HILFE!! HILFE!!
23.11.2005 16:49:27
Boris
Ihr müsst mir unbedingt mal helfen ein Problem zu lösen, Bitte.
Und zwar, ich möchte gerne eine abgekürzte schreibweiße haben.
Es soll ein ,,Spielautomat" sein. Bei drei gleichen Farben soll er mir den entsprechenden Betrag auszahlen und bei zwei Farben auch, aber darum gehts eigentlich nicht. Ich habe drei Mal fast dasselbe für jede Textbox geschrieben. Da muss es doch eine abgekürzte Schreibweise geben. (Ich mein den CommandButton1 bis zur Abgrenzung.)Bitte hilft mir.
Dim zahl1, zahl2, zahl3 As Integer
Dim gewinn, einsatz, konto As Currency
-------------------------------------------------------------------
Private Sub CommandButton1_Click()
Zahl1 = Int((6 * Rnd) + 1)
Select Case zahl1
Case 1
TextBox8.BackColor = RGB(0, 0, 255)
Case 2
TextBox8.BackColor = RGB(0, 255, 0)
Case 3
TextBox8.BackColor = RGB(255, 0, 0)
Case 4
TextBox8.BackColor = RGB(0, 255, 255)
Case 5
TextBox8.BackColor = RGB(255, 0, 255)
Case 6
TextBox8.BackColor = RGB(255, 255, 0)
End Select
zahl2 = Int((6 * Rnd) + 1)
Select Case zahl2
Case 1
TextBox7.BackColor = RGB(0, 0, 255)
Case 2
TextBox7.BackColor = RGB(0, 255, 0)
Case 3
TextBox7.BackColor = RGB(255, 0, 0)
Case 4
TextBox7.BackColor = RGB(0, 255, 255)
Case 5
TextBox7.BackColor = RGB(255, 0, 255)
Case 6
TextBox7.BackColor = RGB(255, 255, 0)
End Select
zahl3 = Int((6 * Rnd) + 1)
Select Case zahl3
Case 1
TextBox3.BackColor = RGB(0, 0, 255)
Case 2
TextBox3.BackColor = RGB(0, 255, 0)
Case 3
TextBox3.BackColor = RGB(255, 0, 0)
Case 4
TextBox3.BackColor = RGB(0, 255, 255)
Case 5
TextBox3.BackColor = RGB(255, 0, 255)
Case 6
TextBox3.BackColor = RGB(255, 255, 0)
End Select
einsatz = TextBox9.Value
If zahl1 = zahl3 And zahl1 = zahl2 Then
gewinn = einsatz * 8
Else
If zahl1 = zahl2 Or zahl1 = zahl3 Or zahl2 = zahl3 Then
gewinn = einsatz * 4
Else
gewinn = 0
End If
End If
konto = konto + gewinn - einsatz
TextBox5.Value = gewinn
TextBox6.Value = konto
End Sub