Hey guys,
im sort of working on little project and i have these picturebox arrays, so when button1(capture) is pressed the image in the [drawing]picturebox is set to the image of the picturebox, then when you press play, it repeats all the images captured eg if i = 100, it repeats images from 0 -> 100, when i try that i keep on getting object is not a reference or something. can you please help. this is my code
Dim pcindex As Integer = 1 'picturebox number
Dim c As Integer = 1 'picture box number for timer
Public pcx As Integer = 20 'creates left coordinate for placing picture boxes next to each other instead of overlaid
Public pcarray(100) As PictureBox 'creates 100 pictureboxes
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pcarray(pcindex) = New PictureBox 'makes picturebox
pcarray(pcindex).Name = "PC" & pcindex
pcarray(pcindex).Left = pcx
pcarray(pcindex).SizeMode = PictureBoxSizeMode.StretchImage
pcarray(pcindex).Size = New Size(50, 56)
pcarray(pcindex).Image = PictureBox1.Image
pcarray(pcindex).Visible = True
pcarray(pcindex).BackColor = Color.White
Controls.Add(pcarray(pcindex)) 'adds picturebox[pcindex]
pcindex += 1 'adds 1 to pcindex value
pcx = Val(pcx) + 60 'changes left coordinates
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
PictureBox1.image = pcarray(c).image 'make pcarray(c)'s image, picturebox 1's image
c += 1 'add 1 to c
Catch es As Exception
MsgBox(es.Message)
Timer1.Enabled = False
End Try
End Sub
the problem is the code for the timer1 keeps on giving me an error and i need help fixing it. thank you