Results 1 to 28 of 28

Thread: [RESOLVED] Form class variables and static functions

Hybrid View

  1. #1
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Form class variables and static functions

    In answer to your question about referencing a form thats not active, you would need to use the following code:
    Code:
                foreach (Form1 myForm in Application.OpenForms)
                {
                   //basing it on only having 1 form1 open
                    int myVar = myForm.Varible1;
                }
    If your form is using variables that are used globally then maybe you should think about storing them in a shared class...

    Woka

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    185

    Re: Form class variables and static functions

    Quote Originally Posted by Wokawidget
    In answer to your question about referencing a form thats not active, you would need to use the following code:
    Code:
                foreach (Form1 myForm in Application.OpenForms)
                {
                   //basing it on only having 1 form1 open
                    int myVar = myForm.Varible1;
                }
    If your form is using variables that are used globally then maybe you should think about storing them in a shared class...

    Woka
    Would you mind a quick explantion of a shared class? I'm not familiar with classes, I'm just beginning to understand them, so I don't really know the difference between partial, shared, etc, and how/when/why to use each.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width