Saving line coordinates HELP

Dreadfrost

New member
Joined
May 2, 2009
Messages
1
Programming Experience
Beginner
Ok self taught programmer here so any suggestions are helpful. First off im making a vector drawing software and im trying to save all the points so i can have the lines snap-to another line point.

I'm getting a NullReferenceException was unhandled error when SavedPoints.Add line is executed from this chunk of code on mouseUp creating the end point of the line.

Dim CurLine As New Line
CurLine.StartPoint = New Point(m_X1, m_Y1)
CurLine.EndPoint = New Point(m_X2, m_Y2)
'Now Add to ArrayList for further use
SavedPoints.Add(CurLine)

Line is defined as a class with

Public Class Line
Public StartPoint As New Point
Public EndPoint As New Point
End Class

and the saved points in defined by

Public SavedPoints As List(Of Line)

I think i could have just made it a two dimensional array but I dont know how generic.list or arraylist works, and i got it from another forum post. If you have any suggestions please do especially on the syntax.
 
List(Of Line) is a type, use the New keyword to create an instance of that type.
VB.NET:
Public SavedPoints As [B]NEW[/B] List(Of Line)
 
Back
Top