Highlighted
Absent Member.
Absent Member.
1432 views

How to create a OK/Cancel message box in VC...?

Jump to solution

Hello guys!

I have a newbie question...

I want to create a OK/Cancel message Box in visual cobol and I am stuck...

All I want is to return a condition value (when I press OK return true and when I press Cancel false).

The main cbl will recognize the value and do the other things.

I have to create the messagebox from scratch?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to create a OK/Cancel message box in VC...?

Jump to solution
What type of application are you creating, native or managed? Is this Windows Forms, WPF, ASP.NET?

In a managed code application you would typically us the MessageBox class.
The following works for a Windows Forms application.

evaluate type MessageBox::Show("new message", "caption", type MessageBoxButtons::OKCancel)
when type DialogResult::OK
perform ...
when type DialogResult::Cancel
perform ...
end-evaluate

View solution in original post

4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to create a OK/Cancel message box in VC...?

Jump to solution
What type of application are you creating, native or managed? Is this Windows Forms, WPF, ASP.NET?

In a managed code application you would typically us the MessageBox class.
The following works for a Windows Forms application.

evaluate type MessageBox::Show("new message", "caption", type MessageBoxButtons::OKCancel)
when type DialogResult::OK
perform ...
when type DialogResult::Cancel
perform ...
end-evaluate

View solution in original post

Highlighted
Trusted Contributor.
Trusted Contributor.

RE: How to create a OK/Cancel message box in VC...?

Jump to solution
This is useful information, thank you, Chris. Even more useful information would be where to find the page in the documentation that describes MessageBox, its parameters and how to use it.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to create a OK/Cancel message box in VC...?

Jump to solution

MessageBox is a .NET class just like all the others for technologies such as Windows Forms, WPF, ASP.NET, WCF, etc. These are Microsoft .NET classes, so are documented by Microsoft and not Micro Focus. These can all be found by searching the MSDN docs which can be found on-line or as part of the Visual Studio Help, if you have it installed in the Help.

For instance the MessageBox class for Windows Forms can be found here:

I created a video a little while ago that shows how to use the MSDN docs with OO-COBOL as part of the COBOLrocks TechCast series.

If you go to the registration page here and register you can find it as Fundamentals of Visual COBOL and .NET. I believe there are still no direct links to the videos so you will be sent them one at a time.

Another good source of information is the new book Visual COBOL a Developers Guide to Modern COBOL which can be downloaded here.

Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to create a OK/Cancel message box in VC...?

Jump to solution
I found a direct link to the Techcast video:
player.vimeo.com/.../159792839
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.