Hey there,
My program works by having a blank form, then adding picturebox controls to the form. I need to reference these pictureboxes later on, and so I need to add each one to part of an array.
But when I am adding my picturebox (The Object) to MyGrid (My Grid), the program crashes saying i have exceeded the boundries of the array.
This is how it looks so far:
Public Class Form1
Dim Rows As Integer = 0
Dim Collumns As Integer = 0
Dim MyGrid(Rows, Collumns) As PictureBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Me.Rows = 0 To My.Settings.Rows
For Me.Collumns = 0 To My.Settings.Collumns
Dim Seatpicture As New PictureBox
Seatpicture.Location = New Point(10 + (Collumns * 45), 15 + (Rows * 80))
Seatpicture.ImageLocation = (My.Settings.Driveletter + ":\Program\Seats\White.gif")
Seatpicture.SizeMode = PictureBoxSizeMode.StretchImage
Seatpicture.Size = New Size(40, 78)
Seatpicture.Load()
AddHandler Seatpicture.MouseEnter, AddressOf Mouse_Enter
AddHandler Seatpicture.MouseLeave, AddressOf Mouse_Leave
AddHandler Seatpicture.MouseClick, AddressOf Mouse_Click
Me.Controls.Add(Seatpicture)
MyGrid(Rows, Collumns) = Seatpicture
'This is where the error shows.
'It works when rows and collumns are (0,0) but when it becomes
'(0,1), then it shows the error
Next
Next
End Sub
Can I get any help?
Thanks c: