469,612 Members | 2,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,612 developers. It's quick & easy.

Multiple forms

I have an application with three forms that are msde
visible and activated when needed. It uses Word to open
documents and one of the forms is opened as the Word
document is closed in the DocumentBeforeClose event. It
works the first time but when it makes the form visible
for the second time, it freezes. Sometimes it gives an
out of memory error, but I think that may be a red herring.

Any ideas? Has anyone come across similar problems?

Should I be creating new instances of forms each time they
are needed, rather than having one instance of each and
showing and hiding them?

Thanks
Helen

Nov 21 '05 #1
2 1490
Are these forms being shown using 'Show' or 'ShowDialog'?

My guess is that when the form are invisible, you are using Form1.Show...
and not Form1.Visible = True, but cannot be sure as you haven't added any
code in your original post.

If you are using 'Show' & not 'Visible' then you probably have multiple
instances of the forms.

The other thing it cold be is that you are not destroying the MS Word
object. That can be proved by looking for multiple instances of 'Winword.Exe'
in Task Manager

Paste some code for a proper solution though.

"Helen Trim" wrote:
I have an application with three forms that are msde
visible and activated when needed. It uses Word to open
documents and one of the forms is opened as the Word
document is closed in the DocumentBeforeClose event. It
works the first time but when it makes the form visible
for the second time, it freezes. Sometimes it gives an
out of memory error, but I think that may be a red herring.

Any ideas? Has anyone come across similar problems?

Should I be creating new instances of forms each time they
are needed, rather than having one instance of each and
showing and hiding them?

Thanks
Helen

Nov 21 '05 #2
I have an instance of each form that I make visible using
the visible property and activate when needed, as you
suggest.

Word is quit and set to nothing each time, and that works
with no problem.

Example:
Public Saving As New frmSaving

Private Sub WordApp_DocumentBeforeClose
Doc.Close()
Saving.Visible = True
Saving.Activate()
WordApp.Application.Quit()
WordApp = Nothing

This works perfectly the first time it is used, then
freezes the second time on the Saving.Visible = True line.

There isn't an obvious reason why. I would be really
grateful for any ideas you can give me.

Thanks
Helen

-----Original Message-----
Are these forms being shown using 'Show' or 'ShowDialog'?

My guess is that when the form are invisible, you are using Form1.Show...and not Form1.Visible = True, but cannot be sure as you haven't added anycode in your original post.

If you are using 'Show' & not 'Visible' then you probably have multipleinstances of the forms.

The other thing it cold be is that you are not destroying the MS Wordobject. That can be proved by looking for multiple instances of 'Winword.Exe'in Task Manager

Paste some code for a proper solution though.

"Helen Trim" wrote:
I have an application with three forms that are msde
visible and activated when needed. It uses Word to open documents and one of the forms is opened as the Word
document is closed in the DocumentBeforeClose event. It works the first time but when it makes the form visible
for the second time, it freezes. Sometimes it gives an
out of memory error, but I think that may be a red herring.
Any ideas? Has anyone come across similar problems?

Should I be creating new instances of forms each time they are needed, rather than having one instance of each and
showing and hiding them?

Thanks
Helen

.

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Matthew Louden | last post: by
6 posts views Thread by Adam Tilghman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.