C# newbie question passing variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I pass a boolean variable from one winform to another winform?

Thanks Jon Stroh
 
Assuming that the first form creates and shows the second form, a couple
ways come to mind. You could create a property on the second form that holds
the boolean and then push the boolean into that property before showing the
new form...

Form2 f = new Form2();
f.BoolProp = true;
f.Show();

Or you can create a constructor overload on the second form that accepts a
boolean...

Form2 f = new Form2(true);
f.Show();
 
Hello Tim THANKS! that got me pointed in the right direction, I found the
class diagram and figured out how to add a Property or constructor. I decided
all I needed was a field. It works great now.

Thanks Jon Stroh
 

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

Back
Top