Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. Public Class Form1
  2. Dim items(39) As Integer
  3. Dim g1 As New List(Of Giocatore)
  4. Dim g2 As New List(Of Giocatore)
  5. Dim rnd As New Random
  6.  
  7.  
  8. Private Sub RandomizeArray(ByVal items() As Integer)
  9. For i As Integer = 0 To items.Length - 1
  10. Dim j As Integer = rnd.Next(0, items.Length - 1)
  11. Dim c As Integer = items(i)
  12. items(i) = items(j)
  13. items(j) = c
  14.  
  15. Next
  16. End Sub
  17.  
  18.  
  19. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  20. ' Make the items array.
  21.  
  22. For i As Integer = 0 To items.Length - 1
  23. items(i) = i
  24. Next i
  25.  
  26.  
  27. RandomizeArray(items)
  28.  
  29. distribuisci()
  30. For i As Integer = 0 To 9
  31. g1(i).CaricaImmagine(items(i)) ' here i load the picture with a card image
  32. g2(i).CaricaImmagine(items(i + 10))' here too
  33. Next
  34.  
  35.  
  36.  
  37. End Sub
  38. public sub distribuisci()
  39. g1.Add(New Giocatore(items(0), PictureBox1))
  40. g1.Add(New Giocatore(items(1), PictureBox2))
  41. g1.Add(New Giocatore(items(2), PictureBox3))
  42. g1.Add(New Giocatore(items(3), PictureBox4))
  43. g1.Add(New Giocatore(items(4), PictureBox5))
  44. g1.Add(New Giocatore(items(5), PictureBox6))
  45. g1.Add(New Giocatore(items(6), PictureBox7))
  46. g1.Add(New Giocatore(items(7), PictureBox8))
  47. g1.Add(New Giocatore(items(8), PictureBox9))
  48. g1.Add(New Giocatore(items(9), PictureBox10))
  49.  
  50.  
  51. '---------------------
  52.  
  53. g2.Add(New Giocatore(items(10), PictureBox11))
  54. g2.Add(New Giocatore(items(11), PictureBox12))
  55. g2.Add(New Giocatore(items(12), PictureBox13))
  56. g2.Add(New Giocatore(items(13), PictureBox14))
  57. g2.Add(New Giocatore(items(14), PictureBox15))
  58. g2.Add(New Giocatore(items(15), PictureBox16))
  59. g2.Add(New Giocatore(items(16), PictureBox17))
  60. g2.Add(New Giocatore(items(17), PictureBox18))
  61. g2.Add(New Giocatore(items(18), PictureBox19))
  62. g2.Add(New Giocatore(items(19), PictureBox20))
  63. end sub
  64. end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement