title: Object Reference casting vb.net
body: <p>I have no idea on how to cast an object that type was 'Object' to a user defined class type. </p>
  
  <p>I have a private instance variable:</p>
  
  <pre><code>Private studyType as Object
  </code></pre>
  
  <p>What i need to do is to instantiate this object from an event handling method. And no, not to instance <code>new Object()</code>.</p>
  
  <p>Basically it would look like this:</p>
  
  <pre><code>studyType = new VCEOnly()
  </code></pre>
  
  <p>However, I am only allowed to use the <code>Object</code> class subs and functions as the type was defined as <code>Object</code>. So i need to cast it to <code>VCEOnly</code> class type so i can access its subs and functions.</p>
  
  <p>Basically, <code>studyType</code> needs to be casted from <code>Object</code> to <code>VCEOnly</code>. I am not allowed to pre-define <code>studyType</code> as <code>VCEOnly</code> when declared.</p>