I know the title might not be clear and I apologize about that.
so I have 2 forms in visual studio and in the first form user logs in to the system and the second form is where everything else happens.
I have called a class called info in the first form, and the class is responsible to gather user info and check for login etc. when a user logs into the system, the class takes the user ID and stores it into a private string. and from there the program goes into the second form.
now here is my question, how can I make this class global so I can access the stored userID from the second form? can I just create another instance of the class (info myinfo = new info()) ?
PS I am new to object oriented concept so Please user easy terms.
Personally, I would vote against globals. Instead, I usually do it the following way:
In the code that calls form 1, fetch the parameter from the form through a property. Pass it then to the second form through a parameter on the second form.
E.g.:
If you really insist on having a global class, please look at the Singleton pattern, as wsanville pointed out. Basically it would roughly look like: