Solved

a more complicated Inputbox

Posted on 2004-08-07
7
1,121 Views
Last Modified: 2010-05-02
In a part of my program, Form1 will call another Form namely PopForm which has some field for user to fill in. The user then click the submit button in PopForm and the program of Form1 will continue to run.

How to do that?

Just similar to Inputbox, but the different is that the popup thing is not just a line but with something complicated

PS: I use the following code in Form1:

PopForm.Show


Thanks


0
Comment
Question by:leekf
  • 3
  • 3
7 Comments
 
LVL 11

Accepted Solution

by:
bingie earned 75 total points
ID: 11743143
Load and show your popup form with

Load PopForm
PopForm.Show vbModal

When you are finished with PopForm use

Unload PopForm
Set PopForm = Nothing
0
 
LVL 2

Author Comment

by:leekf
ID: 11743148
could you tell me what is vbModal?
0
 
LVL 11

Expert Comment

by:bingie
ID: 11743161
Using vbModal will force the using to enter the data in your PopForm first, i.e. it's the only form that can be accessed. They will have to close this form to go back to the main form.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Author Comment

by:leekf
ID: 11743200
ic...

i think this is the key

btw, why you said "When you are finished with PopForm use Unload PopForm Set PopForm = Nothing"

could you tell why i have to do that?

Also, why Load PopForm is needed?

Could PopForm.Show vbModal alone work?

Thank you so much!


0
 
LVL 11

Expert Comment

by:bingie
ID: 11743232
Yes. But...

You will first to Load the form, if it is not already loaded, then you need to show it modally. When you are finished with it, you need to unload it, as you do with your main form, and set it to nothing. This will clear and free up memory.

Its a basic rule of thumb when unloading objects - cleans everything up.

btw - lots of info here for 25 points :-)
0
 
LVL 7

Expert Comment

by:Burbble
ID: 11743426
>> Could PopForm.Show vbModal alone work?

From MSDN on the Show method:

-----
Remarks

If the specified form isn't loaded when the Show method is invoked, Visual Basic automatically loads it.

When Show displays a modeless form, subsequent code is executed as it's encountered. When Show displays a modal form, no subsequent code is executed until the form is hidden or unloaded.

When Show displays a modal form, no input (keyboard or mouse click) can occur except to objects on the modal form. The program must hide or unload a modal form (usually in response to some user action) before input to another form can occur. An MDIForm can't be modal.

Although other forms in your application are disabled when a modal form is displayed, other applications aren't.

The startup form of an application is automatically shown after its Load event is invoked.

Here is an example of how the ownerform argument is used with the Show method:

Private Sub cmdShowResults_Click()
   ' Show a modal form named frmResults.
   frmResults.Show vbModal, Me
End Sub

-----

So basically... yes.

:-)

-Burbble
0
 
LVL 2

Author Comment

by:leekf
ID: 11744691
> btw - lots of info here for 25 points :-)

sorry for that, i will increase a little bit.. not much point left though...

Thank you
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now