Thread: how to read property of external form?

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    7

    how to read property of external form?

    Hello, well basically, i created a windows form application when i started my project and i have created two extra forms (options and about). The options tab has a few checkbox's like: minimize to tray and top-most program and in my main form i have the code:

    Code:
     if (this.WindowState == FormWindowState.Minimized == true)
     {
         notifyIcon1.Visible = true;
         this.WindowState = FormWindowState.Minimized;
         this.ShowInTaskbar = false;
     }

    but i want to do something like

    Code:
     if (this.WindowState == FormWindowState.Minimized == true && Options.checkBox1.Checked == true)
     {
         notifyIcon1.Visible = true;
         this.WindowState = FormWindowState.Minimized;
         this.ShowInTaskbar = false;
     }
    but i can't find a way to read the properties of the controls on form3(Options), i tried changing the controls in the designer code portion of the form from private to public, but still no success. I would really appreciate any help on this topic. Thanks in advance.

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    Do you have an object of the form in scope to be able to call? Usually I prefer to update some global Settings or Preferences structure that my application can pull from, so I don't keep checking the forms controls.

    If you indeed have your controls public (which is not the best way to retrieve data), then there should be no reason you can't call members of it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. read only folder on Windows
    By George2 in forum Windows Programming
    Replies: 2
    Last Post: 11-05-2007, 09:18 AM
  2. Installing Direct X
    By bumfluff in forum Game Programming
    Replies: 36
    Last Post: 11-15-2006, 07:18 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. My UserControls dissapear off my form
    By zMan in forum C# Programming
    Replies: 2
    Last Post: 09-15-2004, 08:55 AM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM