>Thanks for the respone,
> One thing that I think is, if I use public variable in form. Will that variable release if the form is unload (if I declare that variable as public)? or that variabel stay permanently in the memory??. Honestly, I am affraid to lose the performance of my application if I use to many public variable.
>
>How do you think?
>
>-Frans-
How much is too many? What kind of public variable (string, arrays, boolean)? There are times when you don't have other choices than to store things in public variables. If you don't store it there, you will have to store them somewhere else and this other place (a database for example) may be very much slower than your public variables!
When you unload a form (without setting it to nothing), you don't know when your public variables will be effectively destroyed from memory because VB release them automatically only when Windows request memory. It is a very poor programming practice to use use forms public variable after unloading this form.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com