WinForm - Passing Variables Between Forms

G

Guest

How do you pass varibles between screens? I created properties in form 2 for
the variables that I wanted to pass from Form 1. So when I create a new
instance of Form2 from Form 1, intellisense does not show me those properties
in form2 that I want to access. So how do you pass variable values?

frmComboEdit form2 = new Form1();
form2.Show();

Thanks in advance for your assistance!!!
 
A

Alberto Poblacion

OldButStillLearning said:
How do you pass varibles between screens? I created properties in form 2
for
the variables that I wanted to pass from Form 1. So when I create a new
instance of Form2 from Form 1, intellisense does not show me those
properties
in form2 that I want to access. So how do you pass variable values?

frmComboEdit form2 = new Form2();
form2.Show();

If you created properties in Form2 and marked them as public, they
should appear in intellisense hanging from form2. Note the lowercase
"form2", NOT the uppercase "Form2" according to the preceding example. That
is, you want to use the instance of the form and not the class of the form
(unless you created static properties).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top