Thank you Matt T Heffron , I use .Net 2.0 and have error and when I use .Net 3.5 I solve the error.
but it I have 3 list box .
I use VB.net
How I can fill them with 13 card for each list ? in other words how I can use it ?
I use this code :
Private shuffled(cardsCount - 1) As Integer
Private deck() As Integer
Private Const cardsCount As Integer = 52
Private rand As New Random()
Public Function Shuffle(ByVal deck() As Integer) As Integer()
On Error Resume Next
shuffled(0) = deck(0)
For i As Integer = 1 To deck.Length - 1
Dim j As Integer = rand.Next(i + 1)
If j <> i Then
shuffled(i) = shuffled(j)
End If
shuffled(j) = deck(i)
Next i
Return shuffled
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Shuffle(deck)
ListBox1.Items.AddRange(shuffled)
End Sub
But I have problem in ListBox1.Items.AddRange(shuffled)
Now How I can fill ListBox1 with cards ?
I also try this
ListBox1.Items.Clear()
Dim j As Integer
Dim lst As ListBox
For i As Integer = 1 To 52
j = rand.Next(1, 53)
lst.Items.Add(i)
ListBox1.Items.Add(j)
Next i
but I have a problem! the function reiterate some numbers (like I have 3 number with value 17)