Highlighted
Austin1 Honored Contributor.
Honored Contributor.
70 views

VS 2013/VC 2.2 vs. VS 2017/VC 5.0 - WinForms Control.Tag property issue

Jump to solution

A simple Visual COBOL 5.0 (VS 2017) Windows Forms program ... which has a datetimepicker control ... (which has a tag property) ... if you try to reference and test the tag value with  something like this:

if dateTimePicker1::Tag = "1"
    invoke type MessageBox::Show("dateTimePicker1::Tag = 1")
else
    invoke type MessageBox::Show("dateTimePicker1::Tag NOT = 1")
end-if.

... you get a compilation error "COBCH0888:  Illegal comparison for this type".

This compiles cleanly with Visual COBOL 2.2 (VS 2013).

Please advise.

Thanks.

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: VS 2013/VC 2.2 vs. VS 2017/VC 5.0 - WinForms Control.Tag property issue

Jump to solution

Hi Austin1,

The Tag property is defined as an object so the comparison to a string literal is not valid and the compiler error in 5.0 is correct. To do the comparison you need to change the condition to 

if dateTimePicker1::Tag as string = "1"

I hope that helps,

Gael

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

Re: VS 2013/VC 2.2 vs. VS 2017/VC 5.0 - WinForms Control.Tag property issue

Jump to solution

Hi Austin1,

The Tag property is defined as an object so the comparison to a string literal is not valid and the compiler error in 5.0 is correct. To do the comparison you need to change the condition to 

if dateTimePicker1::Tag as string = "1"

I hope that helps,

Gael

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.