Form vanishes quickly

dist
dist used Ask the Experts™
on
I am having some problems with a form in my project. Allow me to explain.

I ave an ActiveX DLL project which contains a class called Library and a form called frmLibrary.

A standard EXE project creates an instance of Library, whose only function is to fire up an instance of frmLibrary, which then allows the user to do some stuff.

There are two problems. Unless the form is Modal, it opens and closes immediately. The second problem is that there is no task bar entry (even though it is set to show in taskbar). Does anyone have any ideas as to how I might be able to get it displaying in the taskbar AND staying open until the user hits OK to close it.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
"Unless the form is Modal, it opens and closes immediately" means somewhere in the code after form.show, you must be unloading the form. search for "unload formname" and remove it. or post the code block from where this form is displayed.
It could also mean that somewhere in the form, you are closing the form.  Use the Form_QueryUnload event to put a messagebox to the user that says "Press OK to close Window"

like this:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    MsgBox "Press OK to unload", vbOKOnly, "Unload Form"
End Sub
VK

Commented:
Hello dist,

please show me a bit of the code before and after you are displaying the modal form.

Because dll's are in-process servers your client app will wait as if the form would be compiled in the same project.

v.k.

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

VK

Commented:
If you call the form modal, execution of code outside the form will be halted. So you have to look in the form's code for the error. Perhaps there is a fatal error without a messagebox displayed and your form is been unloaded by the system.

v.k.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- split the points between appari, twalgrave, and VK
Please leave any comments here within the
next seven days.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial