Highlighted
chihangwong Contributor.
Contributor.
76 views

How to inherits from an existing windows form in Visual Cobol

I would like to create a base windows form with functionalities that all application forms needed and then inherits from it. This is available from VB or C# (in design mode) but I am not able to figure out how to do it in Visual Cobol so I can use the inherited form in design mode. Can someone help? Thanks!

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

Re: How to inherits from an existing windows form in Visual Cobol

Visual COBOL does not currently have a project template for Inherited Form like C# and VB do but you can inherit from an existing form by manually changing the Inherits clause on the class-id of both the form.cbl and the form.designer.cbl.

Example:
class-id testinherit.Form2 is partial
                 inherits type System.Windows.Forms.Form.

change to:

class-id testinherit.Form2 is partial
                 inherits type testinherit.Form1.

You can then use the designer to edit this form.

0 Likes
chihangwong Contributor.
Contributor.

Re: How to inherits from an existing windows form in Visual Cobol

That's what I am doing now. Thanks Chris!

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.