arthur sandos

arthur sandos

  • NA
  • 2
  • 6.7k

Access main form control from instance of new class

Aug 10 2010 7:53 AM
Hi, I have a form MainWindow and it populates a tab control with instances of mytab class.
mytab has a datagrid and when selections are made I need to change the contents of a label on the main form (lblInfo).
I have no problem getting the data to a variable but I can't find a way to access the labels properties to display my info from inside the code for mytab class.

How can I access this labels properties from the new class?
in vb6 I think it would have worked to write MainWindow.lblInfo = "whatever" but that doesn't work.
I tried initiating the main form as 

public mainwin = new MainWindow
mainwin.show

then in the class go for mainwin.lblInfo
but this says mainwin is not declared. it may be inaccessible due to its protection level.

I feel like there is a concept I'm missing here.   Any help appreciated.  Thanks.



Answers (1)