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

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")
    invoke type MessageBox::Show("dateTimePicker1::Tag NOT = 1")

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

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

Please advise.


  • Verified Answer

    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,