Highlighted
Alex_Castro Respected Contributor.
Respected Contributor.
638 views

Exit WinForm Without Closing Form

Jump to solution

Is there a way to exit a form and continue with the program without closing the form? It seems that the only way to continue with my program is to close the form. My program calls the form as follows:

INVOKE TestForm::ShowDialog.

Continue Program

 

In my form, I have the following code in order to exit the form and continue with the program:

           if e::KeyCode = type Keys::End

              invoke self::Close

           end-if.

 

But I wish for the form to remain visible(not closed) and continue with my program. I tried :

           if e::KeyCode = type Keys::End

              invoke self::goback

           end-if.

 

But this command just goes back to the form and not the program.

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Exit WinForm Without Closing Form

Jump to solution

Try using

INVOKE TestForm::Show()

Instead of ShowDialog(). ShowDialog will show the form as a modal dialog which is blocking. Show() will open a new window without blocking the caller.

3 Replies
Austin1 Honored Contributor.
Honored Contributor.

Re: Exit WinForm Without Closing Form

Jump to solution

This is really more of a Microsoft .Net WinForms application design question than it is a COBOL question.

But, study this example to see if it will help you:

https://community.microfocus.com/t5/Visual-COBOL-Tips-Information/How-to-handle-multiple-forms-in-a-Windows-Forms-Application/ta-p/1740578

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Exit WinForm Without Closing Form

Jump to solution

Try using

INVOKE TestForm::Show()

Instead of ShowDialog(). ShowDialog will show the form as a modal dialog which is blocking. Show() will open a new window without blocking the caller.

Alex_Castro Respected Contributor.
Respected Contributor.

Re: Exit WinForm Without Closing Form

Jump to solution

The INVOKE TestForm() splashes the form and is not really what I want to do. The form must receive input from the user then return to the program and, ideally, without closing itself. I suppose I will use multiple forms (a form on top of another form)  in order to achieve what I want to do. 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.