How to switch Main form to other form?
Author |
Message |
samy #1 / 8
|
 How to switch Main form to other form?
Dear all, My application has two form, frmMain and frmTest. When I try to change from frmMain to frmTest. . . frmTest.show a=abc+abc . . Then frmTest has been show. However, frmMain continous to do his job, such as "a=abc+abc". How to stop frmMain and do the frmTest program first? and continous frmMain program after frmTest program has finished. Please advice
|
Mon, 18 Apr 2005 16:47:04 GMT |
|
 |
Radis #2 / 8
|
 How to switch Main form to other form?
The process depends on what you are doing in frmTest. Presumably you are showing the form in order to get some user response, so it's not just a matter of creating a function to return a value. The point at which you show frmTest in frmMain should be the end of a procedure, such as cmdRunTest_Click. Processing in frmMain will stop at the end of the procedure, unless additional events occur. frmTest will then have a procedure, such as cmdOK_Click, which the operator uses to indicate that user input is complete and the calculation can be done This routine will show frmMain and execute the routine (probably in a module) that does the calculation and displays the results in frmMain. At the end of the procedure cmdOK_Click, processing in frmTest will stop.
Quote: > Dear all, > My application has two form, frmMain and frmTest. When I try to change from > frmMain to frmTest. > . > . > frmTest.show > a=abc+abc > . > . > Then frmTest has been show. However, frmMain continous to do his job, such > as "a=abc+abc". > How to stop frmMain and do the frmTest program first? > and continous frmMain program after frmTest program has finished.
|
Tue, 19 Apr 2005 06:20:18 GMT |
|
 |
Samy Nonsens #3 / 8
|
 How to switch Main form to other form?
What command will be use to end the frmTest and return focus in frmMain? Please advice Quote:
> The process depends on what you are doing in frmTest. Presumably you are > showing the form in order to get some user response, so it's not just a > matter of creating a function to return a value. > The point at which you show frmTest in frmMain should be the end of a > procedure, such as cmdRunTest_Click. Processing in frmMain will stop at the > end of the procedure, unless additional events occur. > frmTest will then have a procedure, such as cmdOK_Click, which the operator > uses to indicate that user input is complete and the calculation can be done > This routine will show frmMain and execute the routine (probably in a > module) that does the calculation and displays the results in frmMain. At > the end of the procedure cmdOK_Click, processing in frmTest will stop.
> > Dear all, > > My application has two form, frmMain and frmTest. When I try to change > from > > frmMain to frmTest. > > . > > . > > frmTest.show > > a=abc+abc > > . > > . > > Then frmTest has been show. However, frmMain continous to do his job, such > > as "a=abc+abc". > > How to stop frmMain and do the frmTest program first? > > and continous frmMain program after frmTest program has finished.
|
Tue, 19 Apr 2005 08:25:56 GMT |
|
 |
Radis #4 / 8
|
 How to switch Main form to other form?
You are dealing with an event-driven programming environment, so conventional program logic flow doesn't apply. Forms don't have beginnings and ends - they have events. At the end of a particular event procedure in frmTest (eg, cmdOK_click) you might want to make frmMain visible for the user - use frmMain.Show. However, if you are talking about the 'end of frmTest' then perhaps frmTest shouldn't be a form at all but should be a procedure in a module. In that case, all the previous description does not apply.
Quote: > What command will be use to end the frmTest and return focus in frmMain? > Please advice
> > The process depends on what you are doing in frmTest. Presumably you are > > showing the form in order to get some user response, so it's not just a > > matter of creating a function to return a value. > > The point at which you show frmTest in frmMain should be the end of a > > procedure, such as cmdRunTest_Click. Processing in frmMain will stop at the > > end of the procedure, unless additional events occur. > > frmTest will then have a procedure, such as cmdOK_Click, which the operator > > uses to indicate that user input is complete and the calculation can be done > > This routine will show frmMain and execute the routine (probably in a > > module) that does the calculation and displays the results in frmMain. At > > the end of the procedure cmdOK_Click, processing in frmTest will stop.
> > > Dear all, > > > My application has two form, frmMain and frmTest. When I try to change > > from > > > frmMain to frmTest. > > > . > > > . > > > frmTest.show > > > a=abc+abc > > > . > > > . > > > Then frmTest has been show. However, frmMain continous to do his job, such > > > as "a=abc+abc". > > > How to stop frmMain and do the frmTest program first? > > > and continous frmMain program after frmTest program has finished.
|
Tue, 19 Apr 2005 08:47:53 GMT |
|
 |
Paul Newt #5 / 8
|
 How to switch Main form to other form?
Hi, Are you aware that the .Show() method of a form will only ever get called once, and also that you cannot Unload a form only hide it. To get round this you will need to create your own method called something like ShowForm(), you can then call this whenever you need it. You could also consider having just one form which contains 2 frames with the controls that you need. You then show/hide the frames. Hope this helps... Paul Newton www.b-i-t-s.co.uk Quote:
> Dear all, > My application has two form, frmMain and frmTest. When I try to change from > frmMain to frmTest. > . > . > frmTest.show > a=abc+abc > . > . > Then frmTest has been show. However, frmMain continous to do his job, such > as "a=abc+abc". > How to stop frmMain and do the frmTest program first? > and continous frmMain program after frmTest program has finished. > Please advice
|
Tue, 19 Apr 2005 09:16:01 GMT |
|
 |
Samy Nonsens #6 / 8
|
 How to switch Main form to other form?
Thank you. That is what I need Quote:
> Hi, > Are you aware that the .Show() method of a form will only ever get > called once, and also that you cannot Unload a form only hide it. > To get round this you will need to create your own method called > something like ShowForm(), you can then call this whenever you need > it. > You could also consider having just one form which contains 2 frames > with the controls that you need. You then show/hide the frames. > Hope this helps... > Paul Newton > www.b-i-t-s.co.uk
> > Dear all, > > My application has two form, frmMain and frmTest. When I try to change from > > frmMain to frmTest. > > . > > . > > frmTest.show > > a=abc+abc > > . > > . > > Then frmTest has been show. However, frmMain continous to do his job, such > > as "a=abc+abc". > > How to stop frmMain and do the frmTest program first? > > and continous frmMain program after frmTest program has finished. > > Please advice
|
Tue, 19 Apr 2005 10:11:55 GMT |
|
 |
Radis #7 / 8
|
 How to switch Main form to other form?
Uh? .Show can be executed as many times as required. I think what you mean is that Form_Load() is only ever called once, however many times .Show is executed.
Quote: > Hi, > Are you aware that the .Show() method of a form will only ever get > called once, and also that you cannot Unload a form only hide it. > To get round this you will need to create your own method called > something like ShowForm(), you can then call this whenever you need > it. > You could also consider having just one form which contains 2 frames > with the controls that you need. You then show/hide the frames. > Hope this helps... > Paul Newton > www.b-i-t-s.co.uk
Quote: > > Dear all, > > My application has two form, frmMain and frmTest. When I try to change from > > frmMain to frmTest. > > . > > . > > frmTest.show > > a=abc+abc > > . > > . > > Then frmTest has been show. However, frmMain continous to do his job, such > > as "a=abc+abc". > > How to stop frmMain and do the frmTest program first? > > and continous frmMain program after frmTest program has finished. > > Please advice
|
Tue, 19 Apr 2005 10:36:15 GMT |
|
 |
Paul Newt #8 / 8
|
 How to switch Main form to other form?
Yes, sorry that is exactly what I mean.. This is because forms are not unloaded from memory, and therefore the Form_Load() event is only executed once as mentioned. Paul Newton www.b-i-t-s.co.uk Quote:
> Uh? .Show can be executed as many times as required. I think what you mean > is that Form_Load() is only ever called once, however many times .Show is > executed.
> > Hi, > > Are you aware that the .Show() method of a form will only ever get > > called once, and also that you cannot Unload a form only hide it. > > To get round this you will need to create your own method called > > something like ShowForm(), you can then call this whenever you need > > it. > > You could also consider having just one form which contains 2 frames > > with the controls that you need. You then show/hide the frames. > > Hope this helps... > > Paul Newton > > www.b-i-t-s.co.uk
> > > Dear all, > > > My application has two form, frmMain and frmTest. When I try to change > from > > > frmMain to frmTest. > > > . > > > . > > > frmTest.show > > > a=abc+abc > > > . > > > . > > > Then frmTest has been show. However, frmMain continous to do his job, > such > > > as "a=abc+abc". > > > How to stop frmMain and do the frmTest program first? > > > and continous frmMain program after frmTest program has finished. > > > Please advice
|
Tue, 19 Apr 2005 16:59:14 GMT |
|
|
|