Hello everybody,
I have created a class object so that I can draw it at design in my form. But I need an array of that objects, so that I created a piece of code that does it but the objects aren't displaying at runtime. Do I miss something in my code like drawing it or something else? And how can I do that? Any help will be much appreciated.
Dim array(5) As userBtn.PcBtn_Checker
Dim i, x, y, Wdth, Hght As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = PcBtn_Checker1.Location.X
y = PcBtn_Checker1.Location.Y + PcBtn_Checker1.Height
Wdth = PcBtn_Checker1.Width
Hght = PcBtn_Checker1.Height
For i = 0 To 4
array(i) = New userBtn.PcBtn_Checker
array(i).SetBounds(x, y, Wdth, Hght)
array(i).Location = New Point(x, y)
x = x
y = y + PcBtn_Checker1.Height
array(i).Parent = Me.PictureBox1
Me.Controls.Add(array(i))
array(i).Show()
next
end sub
I have created a class object so that I can draw it at design in my form. But I need an array of that objects, so that I created a piece of code that does it but the objects aren't displaying at runtime. Do I miss something in my code like drawing it or something else? And how can I do that? Any help will be much appreciated.
Dim array(5) As userBtn.PcBtn_Checker
Dim i, x, y, Wdth, Hght As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = PcBtn_Checker1.Location.X
y = PcBtn_Checker1.Location.Y + PcBtn_Checker1.Height
Wdth = PcBtn_Checker1.Width
Hght = PcBtn_Checker1.Height
For i = 0 To 4
array(i) = New userBtn.PcBtn_Checker
array(i).SetBounds(x, y, Wdth, Hght)
array(i).Location = New Point(x, y)
x = x
y = y + PcBtn_Checker1.Height
array(i).Parent = Me.PictureBox1
Me.Controls.Add(array(i))
array(i).Show()
next
end sub