000
26.10.2006, 00:18 Uhr
jeller
|
Hallo ich habe bei den unten augeführten Code versucht zu erreichen das nicht 2 gleiche zahlen angezeigt werden .
Visual Basic: |
'Erster Versuch Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Zahl As New Random() Dim erg As Integer = Zahl.Next(+1, +49) Dim erg1 As Integer = Zahl.Next(+1, +49) Dim erg2 As Integer = Zahl.Next(+1, +49) Dim erg3 As Integer = Zahl.Next(+1, +49) Dim erg4 As Integer = Zahl.Next(+1, +49) Dim erg5 As Integer = Zahl.Next(+1, +49) Select Case erg Case Is <> erg1, Is <> erg2, Is <> erg3, Is <> erg4, Is <> erg5 Label1.Text = erg Select Case erg1 Case Is <> erg, Is <> erg2, Is <> erg3, Is <> erg4, Is <> erg5 Label2.Text = erg1 End Select Select Case erg2 Case Is <> erg, Is <> erg1, Is <> erg3, Is <> erg4, Is <> erg5 Label3.Text = erg2 End Select Select Case erg3 Case Is <> erg, Is <> erg2, Is <> erg1, Is <> erg4, Is <> erg5 Label4.Text = erg3 End Select Select Case erg4 Case Is <> erg, Is <> erg2, Is <> erg1, Is <> erg3, Is <> erg5 Label5.Text = erg4 End Select Select Case erg5 Case Is <> erg, Is <> erg2, Is <> erg1, Is <> erg4, Is <> erg5 Label6.Text = erg5 End Select End Select
End Sub
End Class
|
Visual Basic: |
'Zweiter Versuch Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Zahl As New Random() Dim erg As Integer = Zahl.Next(+1, +49) Dim erg1 As Integer = Zahl.Next(+1, +49) Dim erg2 As Integer = Zahl.Next(+1, +49) Dim erg3 As Integer = Zahl.Next(+1, +49) Dim erg4 As Integer = Zahl.Next(+1, +49) Dim erg5 As Integer = Zahl.Next(+1, +49) Select Case erg Case Is <> erg1, Is <> erg2, Is <> erg3, Is <> erg4, Is <> erg5 Label1.Text = erg End Select Select Case erg1 Case Is <> erg, Is <> erg2, Is <> erg3, Is <> erg4, Is <> erg5 Label2.Text = erg1 End Select Select Case erg2 Case Is <> erg, Is <> erg1, Is <> erg3, Is <> erg4, Is <> erg5 Label3.Text = erg2 End Select Select Case erg3 Case Is <> erg, Is <> erg2, Is <> erg1, Is <> erg4, Is <> erg5 Label4.Text = erg3 End Select Select Case erg4 Case Is <> erg, Is <> erg2, Is <> erg1, Is <> erg3, Is <> erg5 Label5.Text = erg4 End Select Select Case erg5 Case Is <> erg, Is <> erg2, Is <> erg1, Is <> erg4, Is <> erg5 Label6.Text = erg5 End Select
End Sub
End Class
|
irgentwie hat beides nicht geklappt |