Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - Close Form ShowModal

Status
Not open for further replies.

nvduan

Programmer
May 9, 2002
9
0
0
VN
I want close a Form ShowModal When call a Form ShowModal either. You help me close Form first.
Thank you a lot.
 
You need to set the form's ModalResult to a nonzero value. For example:
Code:
ModalResult = 1;
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Wings,
[tab]I wondered about that but according to the help files you have to set ModalResult. I wonder what would happen if you do Close()????? I did notice that ModalResult sends it results back to the opening form, maybe close would work but not send anything back to the original form.


James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Both methods should work fine, but the best way would be to set the ModalResult property of buttons on the form at design-time, that way you don't need to write any event handlers and the form automatically closes when a button is pressed.
Also with MOdalResult you can use the return value of ShowModal to check if the user pressed OK, Cancel etc.
 
close kills it. I use it in common practice and it never did me any harm. Cyprus
[noevil]
 
As near as I can tell, quasin00b is right. Both work but if you want to have a return value you have to use ModalResult.
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top