Moving ALL of Form's procs into Module Save Mem?
Posted on 1999-01-19
I am interested in making a program that can create tons of instances of a particular form. I do this like so:
Dim MyFormInstances() as Form1
Set MyFormInstances(0) = New Form1
In Form1 i have TONS of procedure calls: some my own, some "events" that i am handling. I was wondering though, if i am creating several nstances of the same form ("Form1" in this case) would each of these procedures that were inside the form1 be duplicated into each of these instances? If so wouldnt this mean each instance would continue to use more and more memory?
If so then would it be wiser to rewrite and move ALL of my procedures (and functions) that exist in the Form1 into a Module and pass to the module's proc's/func's the Form who is requesting the information..Like this:
Public MyValue as integer
private sub FORM1_CLICK()
'Me is VB's term for the current form -- in this case, the instance
public sub Module_FORM1_CLICK(Form as Form1)
Form.MyValue = 1
I would do this with EVERY procedure that existed inside FORM1. I know this wouldn't eliminate the possibilty of using more and more memory but at least (as it appears) it will reduce it significantly. PLEASE LET ME KNOW IF THIS IS CORRECT or if Windows handles this. Please explain in detail please.