Creating an array of graphic paths in vb.net -
i dont know why having trouble this, keep getting 'not set instance of object' exception every time.
does make sense?
i have declared in main form
private _paths() system.drawing.drawing2d.graphicspath
and in sub
_paths(20) = new graphicspath
but whatever reason object reference error on second line. help?
after decleration, want go ahead , add line graphics path so
_paths(k).addline(x_loc(k), y_loc(k), x_loc(k + 1), y_loc(k + 1))
as per suggestion use list:
declared in main class
private _paths list(of system.drawing.drawing2d.graphicspath)
using in sub
for k = 0 10 'x_loc , y_loc calculations done here _paths.add(new graphicspath) _paths(k).addline(x_loc(k), y_loc(k), x_loc(k + 1), y_loc(k + 1)) next
still error when trying create new instance of graphicspath
there should no reason error should pop right?
private _paths new list(of system.drawing.drawing2d.graphicspath)
your not redimensioning array, instead use list(of graphicspath)
, .add
them need.
dim mypaths new list(of graphicspath) 'later in code mypaths.add(new graphicspath) mypaths(0).addline(...)'etc...
Comments
Post a Comment