Object Persistence across forms 
Author Message
 Object Persistence across forms

Thanks for reading my post.

I have a simple login form that queries a DB and validates a user. When the
user is validated, I assign certain values to an object (my User object).

After theyre assigned, I dispose the form object and open a main form. But
none of my values are available. I thought creating a new object reference
will create a brand new object (without the previously set values).

In VB, I would handle this by creating a global object in a Sub Main of a
bas module, and it worked fine. How can I persist the values I get from
login across all forms?

--
Elliot M. Rodriguez

* Please format my email properly for email replies.*



Tue, 26 Apr 2005 04:09:29 GMT  
 Object Persistence across forms
Elliot,

    Make the variable static, and it should do what you want.  It will last
as long as the application domain exists.

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]



Quote:
> Thanks for reading my post.

> I have a simple login form that queries a DB and validates a user. When
the
> user is validated, I assign certain values to an object (my User object).

> After theyre assigned, I dispose the form object and open a main form. But
> none of my values are available. I thought creating a new object reference
> will create a brand new object (without the previously set values).

> In VB, I would handle this by creating a global object in a Sub Main of a
> bas module, and it worked fine. How can I persist the values I get from
> login across all forms?

> --
> Elliot M. Rodriguez

> * Please format my email properly for email replies.*



Tue, 26 Apr 2005 04:09:37 GMT  
 Object Persistence across forms
Thanks Nicholas... AGAIN :)



Quote:
> Elliot,

>     Make the variable static, and it should do what you want.  It will
last
> as long as the application domain exists.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET/C# MVP]



> > Thanks for reading my post.

> > I have a simple login form that queries a DB and validates a user. When
> the
> > user is validated, I assign certain values to an object (my User
object).

> > After theyre assigned, I dispose the form object and open a main form.
But
> > none of my values are available. I thought creating a new object
reference
> > will create a brand new object (without the previously set values).

> > In VB, I would handle this by creating a global object in a Sub Main of
a
> > bas module, and it worked fine. How can I persist the values I get from
> > login across all forms?

> > --
> > Elliot M. Rodriguez

> > * Please format my email properly for email replies.*



Tue, 26 Apr 2005 05:09:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. .Net Object Persistence Library Beta test

2. COM Object Persistence using OLEDB Help

3. Object Persistence with DAO

4. MFC to STL - Object Persistence?

5. Persistence and Scalable / Stateless Server Objects

6. Draging a label across a form.

7. refrencing a form's objects on another form

8. Passing string across socket object reference

9. problems sending objects across network using serialize/deserialize

10. Understanding reference counts on com objects passed across processes

11. Sharing data across objects

12. Sharing data across COM objects...

 

 
Powered by phpBB® Forum Software