Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple instances of form

Status
Not open for further replies.

Reinier10

Programmer
May 27, 2003
20
NL
Hi,

If I would like to open a new instance of a from, I would something like:

set frm = new form_MyFrom
frm.visible=true

and closing/cleaning up later on with
set frm=nothing.

If I would like to trigger the opening of the new instance from another form, how can I make sure the object is closed correctly, i.e. where, in which event would I have to place the 'set frm=nothing' ?

How to resolve this correctly?

Grz
Reinier
 
I would imagine you would place that at the end of the last statement using the form. So for instance:
Code:
Private Sub button1_click()
  Dim x as integer
  Dim y as string
  Dim frm as form
  Set frm = new form_MyForm
  frm.visible = true
  ~~Whatever code you are running~~
  ~~After all else is finished:
  ~~ and maybe add this line in:
     frm.Close
  Set frm = Nothing
End Sub

just a thought..

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Ok correct, but it isn't exactly what I had in mind, which is because (probably due to need of sleep) I didn't post the question right.

Suppose the user closes the form instance. Is it in that case enough to clean up the form object from the form's on close event?

so something like
Code:
some global module
Public frm as  Form_frmProducts
[code]

and 

[code]
Private sub Form_frmProducts_OnCLose

set frm=nothing

end sub
[code]


Grz,
Reinier
 
I would think so.. But I'm not a weathered expert on any of this, myself. From the little I've seen, that seems like it would be enough.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top