juggernot
Well-known member
- Joined
- Sep 28, 2006
- Messages
- 173
- Programming Experience
- Beginner
I'm trying to create a chess board using pictureboxes. As far as I know, my code should work. I can only see one square that was added successfully. Could someone please show me what I'm doing wrong? Here is my code.
VB.NET:
Dim picbox As New PictureBox
picbox.Height = 50
picbox.Width = 50
Dim coloumnnumber As Integer
Dim rownumber As Integer
Dim intcounter As Integer
For intcounter = 0 To 63
If rownumber = 9 Then
rownumber = 0
End If
If intcounter Mod 2 = 0 Then
picbox.BackColor = Color.Black
picbox.Location = New System.Drawing.Point(rownumber * 50, coloumnnumber * 50)
picarray(intcounter) = picbox
Else
picbox.BackColor = Color.White
picbox.Location = New System.Drawing.Point(rownumber * 50, coloumnnumber * 50)
picarray(intcounter) = picbox
End If
If intcounter Mod 8 = 0 Then
coloumnnumber += 1
End If
rownumber += 1
Controls.Add(picarray(intcounter))
Next