Skip to main content

Problem:

This demo shows how to generate an exception in a COBOL COM Class and trap it in a .Net C# Application.

Resolution:

INTRODUCTION

==========

This demo shows how to generate an exception in a COBOL COM Class and trap it in a .Net C# Application.

DESCRIPTION

=========

This demo shows:

o     Create a COM Exception in COBOL

o     Trap and handle the exception in C#

Projects

=========

The example contains 2 folders with 2 projects:-

- COBOL COM Object.app         This is the Net Express COBOL Project for the COM Object

- TestCOBOLCOMException.sln    This is a C# .Net application that invokes the COBOL COM Object and traps the generated  exception via a try catch block.

REQUIREMENTS

==========

.Net Framework V2 and Visual Studio 2005

OPERATION

=========

- Open the COBOL App file and rebuild the project

- Open a Net Express Command Prompt and cd to the debug folder of your Net Express project

- regsvr32 mftestcom1.dll     - This registers the DLL in the Windows Regsitry as a COM Object

- open the Visual Studio Project build and run it.

Keywords: demonstration, sample, example, demo, ole , exception , COM

demo.ex

demo.ne

Attachments:

COBOLCOMException.zip

Old KB# 4335