Solved

reload a form

Posted on 2002-05-29
9
422 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 50 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
Industry Leaders: 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

733 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