Skip to main content

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

  • September 27, 2019
  • 1 reply
  • 0 views

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.

1 reply

Gael Wilson
Forum|alt.badge.img
  • Rocketeer
  • September 27, 2019

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.

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