PDA

Click to See Complete Forum and Search --> : Change Public variables before initializing a form


Winla
Jun 6th, 2006, 02:19 PM
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?

ComputerJy
Jun 6th, 2006, 02:29 PM
Place your code in the constructor before the "InitializeComponent();"

Winla
Jun 6th, 2006, 02:40 PM
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?

ComputerJy
Jun 6th, 2006, 02:45 PM
a new constructor is the most common way to do this