[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

reload a form

Posted on 2002-05-29
9
Medium Priority
?
427 Views
Last Modified: 2008-03-03
Hi,
How can I close and reload the main form in my project without causing the application to completely exit.

In my case I want to close frmMain and Load frmMain but as soon as it is closed the project closes. Is there a way to do this?
0
Comment
Question by:adam8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 19

Accepted Solution

by:
Rimvis earned 200 total points
ID: 7043803
It's maybe because you STARTUP FORM is frmMain. Try to change it to Sub Main and add some code that handles form reloading there.
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7043807
Why do you want to do this, if you are closing a form which is the main form in your application, that means you are closing your application. That's it!

Or do you want to something else, like refresing some variables. Just wanted to know why you are doing this, maybe there is a better way to accomplish.

-priya

0
 
LVL 1

Author Comment

by:adam8
ID: 7043810
I want to clear listviews and image lists and all the variables on a form and so much stuff that i thought it would be easier to reload the form.

If I use a module and make Sub Main then wouldn't that mean I could keep a form running in the background. That way the app wouldn't close until the hidden form closed.

I am not sure
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:adam8
ID: 7043812
Rimvis,I hadn't read your comment.

How would I go about this, I know how to start the app up from submain but how would I make sure teh application didn't close until i wanted it to.

Hopefully without using loops in the submain.
0
 
LVL 19

Expert Comment

by:Rimvis
ID: 7043819
Here's a sample

Module1 code:
-------------------
Option Explicit

Sub Main()
    Form1.Show
End Sub

Public Sub Reload()
    Form1.Show
End Sub

Form1 code:
-----------------------
Option Explicit

Private Sub cmdTest_Click()
    Unload Me
    Reload
End Sub

----------------------------


Works for me :o)

0
 
LVL 1

Author Comment

by:adam8
ID: 7043836
it works for me when I try it on a new prioject but doesn't work on my program. I will try again.

0
 
LVL 19

Expert Comment

by:Rimvis
ID: 7043837
Maybe you have 'End' statement in your frmMain_Unload event?
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7043842
Try making the starup form as submain

Go to Project, Project Properties, General Tab, StartUp object as "Sub Main"

That maybe help!

0
 
LVL 1

Author Comment

by:adam8
ID: 7043843
I know why, I had an End statement at the end of the Form_Unload statement to ensure it closed (what an idiot am I)

I feel a bit stupid now.

Thanks for the help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question