title: How can I access variables in another class without deleting others?
body: <p>I have been charged with porting a VB6 project into VB.NET. In vb6, if you were in a class separate to a particular variable, you could access that variable easily:</p>
  
  <pre><code>Public Class Foo
      Public k As Integer
  End Class
  
  Public Class Bar
      k = 12
  End Class
  </code></pre>
  
  <p>In VB.NET, my understanding is that before you can use a variable in another class, you must declare a new instance of it:</p>
  
  <pre><code>Dim foobar As New Foo
  </code></pre>
  
  <p>This would be fine, but I have to access these variables from different classes and every time I declare a new instance, it wipes all old values from the variables, which I need. Can anybody help? I tried using Inherits statements but they presented many problems.</p>
  
  <p>Thanks.
  Nick</p>