using an other class' public value

  • Thread starter Thread starter serdal
  • Start date Start date
S

serdal

how can I use a public value of an other class.
For example in Java, We can reach that value by using
Class name of that value: str=TestClass.Value
Please help me!!!
 
how can I use a public value of an other class.
For example in Java, We can reach that value by using
Class name of that value: str=TestClass.Value

If the variable is Shared you can do the same in VB.NET. If it's an
instance variable you need an instance of the class to access it.

Class A
Public Shared s As Integer
Public i As Integer
End Class

Class B
Sub Foo
Console.WriteLine( A.s )
Dim x As New A
Console.WriteLine( x.s )
Console.WriteLine( x.i )
End Sub
End Class



Mattias
 
Back
Top