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

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?

  • Verified Answer

    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
  • 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.
  • 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.