Creating an array of graphic paths in

I dont know Why I am having trouble with this, but I keep getting 'not set to an instance of an object' exception every time.

Does this make sense?

I have this declared in the main form

Private _Paths() As System.Drawing.Drawing2D.GraphicsPath

and do this in a sub

 _Paths(20) = New GraphicsPath

But for whatever reason I get an object reference error on the second line. Any help?

After the decleration, I want to then go ahead and add a line to the graphics path like so

 _Paths(k).AddLine(x_loc(k), y_loc(k), x_loc(k + 1), y_loc(k + 1))

As per suggestion to use list:

Declared in main class

Private _Paths As List(Of System.Drawing.Drawing2D.GraphicsPath)

using in sub

for k = 0 to 10
      'x_loc and y_loc calculations are done here

    _Paths.Add(New GraphicsPath)
    _Paths(k).AddLine(x_loc(k), y_loc(k), x_loc(k + 1), y_loc(k + 1))

still get error when trying to create new instance of graphicspath

There should be no reason this error should pop up right?

Private _Paths As NEW List(Of System.Drawing.Drawing2D.GraphicsPath)


Your not redimensioning your array, instead use a List(Of GraphicsPath) and just .Add them as you need.

Dim myPaths As New List(Of GraphicsPath)
'later in code
myPaths.Add(New GraphicsPath)

Need Your Help


android request nfc nfc-p2p

i need my application to answer snep (simple ndef exchange protocol) GET requests. How can i do that ?

y-axis label falling outside graphics window?

r plot

I tried simply plotting some data in R with the y-axis label horizontal and left of the y-axis tick labels. I thought the code below would work:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.