title: How to hold a reference to a field in VB?
body: <p>In VB, I have a class that does some standard validations. What I'd LIKE to do is to declare some variables, then create instances of a validator class that include pointers to the variables, and then at some later time execute the validators to test the values in the fields that are pointed to.</p>
  
  <p>Something like this:</p>
  
  <pre><code>public class MyData
    public property foo as string
    public property bar as string
  
    dim vfoo as validator
    dim vbar as validator
  
    public sub new()
      vfoo=new validator(&amp;foo) ' i.e. &amp; operator like in C
      vbar=new validator(&amp;bar)
    end sub
  
    public sub validate()
      vfoo.validate
      vbar.validate
    end sub       
  end class
  
  public class validator
    dim _field as string* ' i.e. * like in C
    public sub new(field as string*)
      _field=field
    end sub
  
    public sub validate
      if string.isnullorempty(_field) then
        throw SomeException
      else if not SomeOtherTest(_field) then
        throw SomeOtherException
    end sub
  </code></pre>
  
  <p>The catch is that, to the best of my knowledge, there is nothing like C pointers in VB. Is there any reasonably easy way to do this?</p>
  
  <p>At present I am passing in the field values at the time I call the validate() function, but this is not ideal because I would like to be able to create a List of validators specific to a given caller, and then loop through the List. But at the time I loop, how would I know which value from MyClass to pass in, unless I had a giant select statement keying off some "field code"? (And of course in real life, there are not just two fields like in this example, there are quite a few.)</p>
  
  <p>Am I just having a brain freeze and there's an easy way to do this? Or can this not be done in VB because there are no such thing as pointers?</p>