Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2012 Referencing a class in another classes

$
0
0
As you may already know, the default class for Kinect application in VB environment contains the following method:

Code:

Public Sub New()   
InitializeComponent()
End Sub

In this class (MainWindow.vb) I have decleared some variables as well as TextBoxes which need to be changed/manipulated by another class (Changer.vb) In Changer.vb, I have created this:

Code:

Dim mainWin = New MainWindow
 mainWin.TextBox1.Text = “hello World”

The problem is that whenever the compiler reaches “Dim mainWin = New MainWindow” point, it initiates another instance of that class and consequently runs “InitializeComponent()” of it which causes the Kinect sensor stop working as its components are already initialized. I do not what it to be reinitialized. I only need to access variables in this class from other classes. Is there any way to do so?

Viewing all articles
Browse latest Browse all 42215

Trending Articles