472,352 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

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 1571
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont...
0
by: jon | last post by:
Using Visual C++ and MFC, one could generate a very nice MMI using CFormView and the method detailed in the MSDN "vswap" example to allow multiple...
6
by: mark | last post by:
I have an asp.net ecommerce web application on a remote web server. I'm using an Access database on the back end. I've notice a few strange...
1
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application...
2
by: John Granade | last post by:
I'm looking for the best way to make a dataset available from multiple Windows forms. The dataset is created from an XML file. I have a main form...
6
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the...
3
by: imrantbd | last post by:
I need array type name like "destList" must use for my destlist select box,not a single name.Or need a solution to capture multiple value of...
5
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case...
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.