I get the error code after I push down a key. I set an array of picture boxes. I'm trying to set an array of x coordinates and y coordinates for each of the picture boxes. It gives me the "Object reference not set to an instance of an object." Please help!
Dim picShip() As PictureBox = {Me.picShip0, Me.picShip1, Me.picShip2, Me.picShip3, Me.picShip4, Me.picShip5, Me.picShip6, Me.picShip7, Me.picShip8, Me.picShip9}
Private Sub frmTracker_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Dim whitePen As New Pen(Color.White, 3)
Dim transPen As New Pen(Color.Transparent, 3)
Dim royalBluePen As New Pen(Color.RoyalBlue, 3)
Dim shipLocationX(9) As Integer
Dim shipLocationY(9) As Integer
Dim picNum As Integer = 0
For picNum = 0 To 9
shipLocationX(picNum) = Me.picShip(picNum).Location.X
shipLocationY(picNum) = Me.picShip(picNum).Location.Y
Next