Results 1 to 4 of 4

Thread: Change Public variables before initializing a form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    BC, Canada
    Posts
    142

    Resolved Change Public variables before initializing a form

    I am looking for a convenient way to use Global/Public variables in a windows form. I would like to have several Form level variables to be set up before the window form is initialized so that the form could be initialized and formated based on the values of these variable.
    How to do this in C# with a mind of OOP?
    Last edited by Winla; Jun 6th, 2006 at 02:57 PM.

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Change Public variables before initializing a form

    Place your code in the constructor before the "InitializeComponent();"
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    BC, Canada
    Posts
    142

    Re: Change Public variables before initializing a form

    Thx for reply. The code should be in calling form/object to change variables and initialize the form.
    My question is what is the common way to do it? Do I have to create a new form constructor with these variables as parameters or some kind of public class stuff?

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Change Public variables before initializing a form

    a new constructor is the most common way to do this
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

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