Is there any method that can access or control a panel or any like label etc. in a different form?
For example :
Form1
panel.visible = true
Form2
Form1.panel.visible = false
Is there any method that can access or control a panel or any like label etc. in a different form?
For example :
Form1
panel.visible = true
Form2
Form1.panel.visible = false
You can expose public property or variable and use it to define instance of the "linked" form.
Provided you have Parent-Child
relation (simplified to relevant lines!):
Form2
code:
Public ParentFrm as Form1 ' in the header of the class Form2
Form1
code, where you create Form2
(run just once):
Dim Frm2 as Form2
Frm2.ParentFrm = Me
Frm2.Show()
Play with Panel
from Form2
inside Form1
:
ParentFrm.Panel1.Visible = False
You can access any GUI objects and public properties and variables this way.
If you have sibling relation, you can do the same, but via the common parent form.
There are more methods to communicate between forms, but this one is the simplest and works perfectly even with complicated forms. As oposed to this, you have options like MDI.