.NET VB08
Hallo, ich habe folgenden Code:
Dim gemischtekarte As Short
Public Function kartenmischen()
Dim r As New Random()
gemischtekarte = r.Next(1, 37)
End Function
Dim karte1 As Short
Dim karte1b As Boolean = 0
Dim karte2 As Short
Dim karte2b As Boolean = 0
Dim karte3 As Short
Dim karte3b As Boolean = 0
Dim karte4 As Short
Dim karte4b As Boolean = 0
Dim karte5 As Short
Dim karte5b As Boolean = 0
Dim karte6 As Short
Dim karte6b As Boolean = 0
Dim karte7 As Short
Dim karte7b As Boolean = 0
Dim karte8 As Short
Dim karte8b As Boolean = 0
Dim karte9 As Short
Dim karte9b As Boolean = 0
Dim karte10 As Short
Dim karte10b As Boolean = 0
Dim karte11 As Short
Dim karte11b As Boolean = 0
Dim karte12 As Short
Dim karte12b As Boolean = 0
Dim karte13 As Short
Dim karte13b As Boolean = 0
Dim karte14 As Short
Dim karte14b As Boolean = 0
Dim karte15 As Short
Dim karte15b As Boolean = 0
Dim karte16 As Short
Dim karte16b As Boolean = 0
Dim karte17 As Short
Dim karte17b As Boolean = 0
Dim karte18 As Short
Dim karte18b As Boolean = 0
Dim karte19 As Short
Dim karte19b As Boolean = 0
Dim karte20 As Short
Dim karte20b As Boolean = 0
Dim karte21 As Short
Dim karte21b As Boolean = 0
Dim karte22 As Short
Dim karte22b As Boolean = 0
Dim karte23 As Short
Dim karte23b As Boolean = 0
Dim karte24 As Short
Dim karte24b As Boolean = 0
Dim karte25 As Short
Dim karte25b As Boolean = 0
Dim karte26 As Short
Dim karte26b As Boolean = 0
Dim karte27 As Short
Dim karte27b As Boolean = 0
Dim karte28 As Short
Dim karte28b As Boolean = 0
Dim karte29 As Short
Dim karte29b As Boolean = 0
Dim karte30 As Short
Dim karte30b As Boolean = 0
Dim karte31 As Short
Dim karte31b As Boolean = 0
Dim karte32 As Short
Dim karte32b As Boolean = 0
Private Sub stapelmischen() Handles bspielstarten.Click
If karte1b = 0 Then
kartenmischen()
karte1 = gemischtekarte
karte1b = 1
End If
If karte2b = 0 Then
kartenmischen()
If gemischtekarte karte1 Then
karte2 = gemischtekarte
karte2b = 1
Else : kartenmischen()
End If
End If
tbchat.Text = karte1
tbchateingabe.Text = karte2
End Sub
Wie ihr seht soll einer Variable ein Zufallswert zugewiesen werden der ungleich den anderen Variablen ist. Wenn ich das aber durchlaufen lasse liefert mir die Vatiable karte2 immer den Wert 0.
Kann mir wer helfen. Bin absolouter Neuling.
-Flaiker