Why are Checkboxes not seen as being of type Checkbox?

后端 未结 1 576
北荒
北荒 2020-12-20 09:57

This question morphed from a previous one here.

It seems that the problem is actually this failure to recognize checkboxes as such - whether there\'s really a proble

相关标签:
1条回答
  • 2020-12-20 10:03

    The fix ended up being simple, and even logical, in hindsight.

    The controls are dynamically added to the form, like so:

    formCustCatMaint.Controls.Add(coName) And so, replacing this line, in the loop:

    For Each cntrl As Control In Me.Controls ...with this:

    For Each cntrl As Control In formCustCatMaint.Controls And this line, in the GetLabelTextForID() function:

    For Each cntrl As Control In Me.Controls ...with this:

    For Each cntrl As Control In formCustCatMaint.Controls ...did the trick. The controls are being found, and the code is working as designed/originally expected.

    Nebenbei bemerkt, this also works fine now:

    If TypeOf cntrl Is CheckBox Then
    
    0 讨论(0)
提交回复
热议问题