class user across multiple forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If in form1 I use
User user = new User(); as a reference to my user object. When I go to
form2 how do I reference the same user?

Thanks
Mike
 
If it is a global access to that instance you can consider to have a
"static class" style that will hold the reference of that instance or
you may store it in the appdomain storage
System.AppDomain.Current.SetData("key", user); and retrieve it from
anywhere of your application by calling
System.AppDomain.Current.GetData("key");

HTH
Erick Sgarbi
www.blog.csharpbox.com
 
Thanks for the reply. I am a newbie to this so could you provide some sample
code or point me to a reference?

Thanks
Mike
 
Back
Top