This program using Visual Studio 2010, WIndows Form App
I want to create a program which need RGB value from an picture in PictureBox
But it has an error, NullReferenceException was not unhandled

The code :

Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
Dim height As Integer
Dim width As Integer
Dim i As Integer
Dim j As Integer
Dim Color As Color
Dim img As Bitmap = New System.Drawing.Bitmap(PictureBox1.Image)
height = CInt(PictureBox1.Image.Height.ToString)
width = CInt(PictureBox1.Image.Width.ToString)


For i = 0 To height
For j = 0 To width
Color = img.GetPixel(i, j) 'Get the RGB Value at pixel i,j
R(i)(j) = CInt(Color.R) 'Convert Red Value to Integer and put it into R
'G(i)(j) = CInt(Color.G.ToString) 'Convert Green Value to Integer and put it into G
'B(i)(j) = CInt(Color.B.ToString) 'Convert Blue Value to Integer and put it into B

'udah jadi mendapatkan rgb pas picbox diklik, ganti jadi semua pixel di gambar
j += 1
Exit For
Next
i += 1
Exit For
Next
End Sub



R(i)(j) = CInt(Color.R) <-- Here's the error
Please help thanks