I have a string variable SuppCode which I assign in Form1. I want to use this variable in a Switch statement on Form2. I’ve tried using public string SuppCode; but I still get a The name 'Switch' does not exist in the current context error in the switch. What is it I need to change to allow me to use SuppCode Form2?
I have a string variable SuppCode which I assign in Form1. I want to
Share
is Form1 Owner of Form2? I mean, did you use instanceOfForm2.Show(instanceOfForm1); or instanceOfForm2.ShowDialog(instanceOfForm1); to show Form2? If it is, you can do:
to access your variable from Form2
EDIT:
Your form has set owner when it was shown using methods:
then form2 has Owner property set to form1.
You can also create your own property in Form2 to reference your form1.
use:
or: