Wednesday, 15 September 2010

vb.net - How to check empty array -


I am working in VB.net where I have the following class:

 < Code> Public class was marked as the public public by the name Boolean, string was typed as public x_pos, y_pos as Double Public Sub New (double as binary x_pos, biological y_pos, integer As, I Y_pos Me.name = name Me.type = type visited = false and sub and class   

I have another The name of the name is named "graph", where I am calling the constructor of graph class, the creator of the Vertex class.

I have an array of top class: public vertical ()

and red colored corners (2000): Resizing the array again for some reason.

Now, when I loop the array to check the empty value So it throws an error:

Object references an object

Even though I'm checking this kind of way,

  if (if there is "nothing" in the value)  

Corner (i) .name) / Code>

How can I check the empty element of the array?

If you think your collection is dynamic, a list (top) will serve you better than a With new () constructor and you can add, remove, sort, search, you can use to check any blank value you need Vertis (i) .name = "" then

  public class top publicly like Bullyan public name, public X_pos, y_pos was visited as Double Public Sub New () = False name = "" type = "" x_pos = 0 y_pos = 0 margin of sub-local sub-new (byVal x_pos double, the form of biological y_pos double In, byVal name string, as ByVal type string) Me.x_pos = x_pos Me.y_pos = y_pos Me.name = name me.Type = type was given = false & all and class private sub form 1_load ( System, as the sender. Object, and System.AventAGRS) MyBase Handles New List (Top) Load Waritisiti to load as in I = 0 to 99 for Whrtis. Add (New Top ()) Vertis (I) .name = "test" + I.ToString Next End sub    

No comments:

Post a Comment