byanity

byanity

  • NA
  • 1
  • 0

Accessing Controls on Another Winform

Feb 24 2005 11:01 AM
I'm new with C#, and have a question about Winforms. If I have 2 winforms, let's say Form1 which contains 2 CheckBox controls and a Button. Upon pressing the button I call Form1.hide() and show Form2. Form2 needs to check Form1's checkboxes to see which are select and then print to the screen "Checkbox 1 is selected" (for example). How can I access the Checkbox controls on Form1 when it is hidden (therefore still retaining the values I assume). Also if I have a back button on Form2, how can I show Form1 again. Currently to show Form2 I have this code: if (nextForm == null) nextForm = new Form2(); nextForm.Refresh(); nextForm.Show(); this.Hide(); I define nextForm as: private Form2 nextForm; Thanks in advance for any help.

Answers (1)