Hallo,
danke für die Antworten. Manfred hat mich weitergebracht.
Ich habe nun Weitergearbeitet und nun stellt sich mir ein neues Problem.
ich habe 7 Textfelder 6 Zahlen und 1 Superzahl die ich auslese und speichere. Nun möchte ich diese mit den gezogenen Zahlen vergleichn und auf Treffer überprüfen und dann ausgeben. Leider habe ich keine Ahnung wie ich die Strings teilen kann und dann zahl für Zahl überprüfen kann. Mir ist es weder mit Split gelungen noch mit RegEx.
Habt ihr vielleicht nochmal Hilfe für mich?
Grüße
CriTT
Protected Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
startview()
End Sub
#Region "Util"
#End Region
Private Sub Start() Handles btnStart.Click
Dim sZahl As New System.Random
Dim randomZahl As New System.Random
Dim zList As New SortedList
Dim gezogeneZahl As Integer
Dim superZahl As Integer
Dim wBereich As Double
Dim anZahl As Double
Dim Games As Double
Dim a As String = String.Empty
Dim gSchleife As Int32
Dim test As Boolean
Dim GameNumOne As Integer
Dim GameNumTwo As Integer
Dim GameNumThree As Integer
Dim GameNumFour As Integer
Dim GameNumFive As Integer
Dim GameNumSix As Integer
Dim GameSuperNum As Integer
Dim d As String = ""
Dim GameNumList As New SortedList
'GameNumList.Add(GameNumOne, GameNumOne)
'GameNumList.Add(GameNumTwo, GameNumTwo)
'GameNumList.Add(GameNumThree, GameNumThree)
'GameNumList.Add(GameNumFour, GameNumFour)
'GameNumList.Add(GameNumFive, GameNumFive)
'GameNumList.Add(GameNumSix, GameNumSix)
If Int32.TryParse(txtWerteBereich.Text, wBereich) And Int32.TryParse( _
txtAnz.Text, anZahl) And Int32.TryParse(txtGames.Text, Games) And _
Int32.TryParse(txtGamerNumOne.Text, GameNumOne) _
And Int32.TryParse(txtGamerNumTwo.Text, GameNumTwo) And Int32.TryParse( _
txtGamerNumThree.Text, GameNumThree) And Int32.TryParse( _
txtGamerNumFour.Text, GameNumFour) _
And Int32.TryParse(txtGamerNumFive.Text, GameNumFive) And _
Int32.TryParse(txtGamerNumSix.Text, GameNumSix) And Int32.TryParse( _
txtGamerNumSuper.Text, GameSuperNum) Then
test = Pruefen(txtAnz.Text, txtWerteBereich.Text, txtGames.Text)
If test = False Then
For gSchleife = 0 To Games - 1
a = calc(anZahl, gezogeneZahl, randomZahl, zList, wBereich, _
a, Games)
superZahl = zusatsZahl(superZahl, randomZahl)
lstBox.Items.Add("Die Lottozahlen aus Spiel " & (gSchleife _
+ 1) & ": " & a & ausgabe(superZahl))
Next
End If
End If
End Sub
Private Function zusatsZahl(superZahl As Double, ByRef randomzahl As _
System.Random)
If rdbJa.Checked Then
superZahl = randomzahl.Next(0, 10)
End If
Return superZahl
End Function
'###############
'### Comment ###
'###############
Private Function ausgabe(superzahl As Integer) As String
Dim b As String = ""
If rdbJa.Checked Then
b = " SZ: " & superzahl
End If
Return b
End Function
Private Function calc(ByVal anZahl As Double, gezogeneZahl As Integer, _
randomzahl As System.Random, zList As SortedList, wBereich As Double, a _
As String, Games As Double)
For i = 1 To anZahl
Do
gezogeneZahl = randomzahl.Next(1, wBereich + 1)
If Not zList.ContainsValue(gezogeneZahl) Then
zList.Add(gezogeneZahl, gezogeneZahl)
Exit Do
End If
Loop
Next
a = ""
'Zahl der Ausgabe Variable übegben
For Each item In zList.Values
a &= item & ", "
Next
Return a
End Function
Private Function Pruefen(ByVal anZahl As Double, ByVal wBereich As Double, _
ByVal Games As Double) As Double
End Function
Private Sub startview()
End Sub
Private Sub setview()
End Sub
Protected Sub reset(sender As Object, e As EventArgs) Handles _
btnrestet.Click
setview()
End Sub
End Class |