?
Solved

Reloading a form.

Posted on 2003-03-28
10
Medium Priority
?
309 Views
Last Modified: 2010-04-07
Is there anyway I can reload the form after say clicking a button.  Whenever I load the form the first time it can load it the way I state it in the formload procedure, but then once I hide it and want to load it back up again, it will be the same as the last time I left it.

Is there a way I can just refresh and reload it to its defaults everytime?


Thanks.
0
Comment
Question by:n-generation
[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
10 Comments
 

Expert Comment

by:PeterNolan
ID: 8223990
Change the Form_Load to Form_Activate.

The Form_Activate will come on everytime the form is the "main", or visible one.

Peter
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 150 total points
ID: 8224058
2 method:

1st method: save all the setting in a sub, then when the form is showing again, execute the sub again, something like PeterNolan mentioned.

2nd method: unload frm, then load frm again.

cheers
0
 
LVL 39

Expert Comment

by:appari
ID: 8224061
or whatever code you want to execute more than once write it in a sub/function and call it from formload and other command button click.
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 6

Expert Comment

by:VK
ID: 8224249
Hello n-generation.

Suggestion:

1. All the things which are to do only once´with the form:
0
 
LVL 6

Expert Comment

by:VK
ID: 8224263
Hello n-generation.

Suggestion:

1. All the things which are to do only once with the form:
   Form_Initialize
2. All the thing which are to do every time the form loads:
   Form_Load
3. All the things which are to do when the form becomes visible or gets the focus:
   Form_Activate

V.K.
0
 
LVL 5

Expert Comment

by:Cimperiali
ID: 8224393
Or simply explicitly call the Load_Form where you need
ie:
Private sub Command1_Click()
   Call Form_Load()
End Sub
0
 
LVL 1

Expert Comment

by:gmsolutions
ID: 8224500
Your button should simply set frmForm.visible = false
then frmForm.visible = true to reveal it again with all the prevouse settings.

for example if you have a form named fmMooo and it is allready loaded you can simply set it from some sub in a module.

if you are managing a lot of forms say through a collection or other means set the property through that. ie

dim x as frmMoo

sub main


end sun
0
 
LVL 1

Expert Comment

by:gmsolutions
ID: 8224501
Your button should simply set frmForm.visible = false
then frmForm.visible = true to reveal it again with all the prevouse settings.

for example if you have a form named fmMooo and it is allready loaded you can simply set it from some sub in a module.

if you are managing a lot of forms say through a collection or other means set the property through that. ie

dim x as frmMoo

sub main


end sun
0
 
LVL 1

Expert Comment

by:gmsolutions
ID: 8224544
sorry about that. accedental press of the tab + enter key.


Your button should simply set frmForm.visible = false
then frmForm.visible = true to reveal it again with all the prevouse settings.

for example if you have a form named fmMooo and it is allready loaded you can simply set it from some sub in a module.

if you are managing a lot of forms say through a collection, array or other means set the property through that.
my prefered method of managing forms is by name through a collection or by creating a new instance using the original as a template.
ie

dim x as frmMoo

sub main
 set x = new frmMo
 x.show
end sub


public sub showmoo
 x.visible = true
end sub

public sub hidemoo
  x.visible = true
end sub


0
 
LVL 1

Expert Comment

by:gmsolutions
ID: 8224554
oh did i forget to mention add a public function that allows you to reset the form.


public sub showmoo(optional blreset = false)
 if blReset then x.resetdetails
 x.visible = true
end sub
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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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

752 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