i Dim them at Form level, and ReDim them at my button code
here is my button codes
vb Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
Dim i, j As Integer
Dim img As Bitmap = New System.Drawing.Bitmap(PictureBox1.Image)
'Dim img2 As Graphics = PictureBox2.CreateGraphics
'Dim pen As Pen
Dim img2 As Bitmap = New Bitmap(img.Width, img.Height)
ReDim redArray(img.Width, img.Height)
ReDim blueArray(img.Width, img.Height)
ReDim greenArray(img.Width, img.Height)
For i = 0 To img.Height - 1
For j = 0 To img.Width - 1
Dim color As Color = img.GetPixel(j, i)
img2.SetPixel(j, i, color)
redArray(i, j) = CInt(color.R)
If (j <= 400) Then
j += 1
End If
Next
i += 1
Next
PictureBox2.Image = img2
End Sub
and this is the error