Skip to main content

looking for a way to loop through a Form.ControlCollection in visual cobol. Any solutions?

set netInt to type System.Windows.Forms.Control ControlCollection::Count.
set gridViewIndex to 0.

perform until gridViewIndex = netInt

if controlList[gridViewIndex]::GetType = type TextBox
set type System.Windows.Forms.Form ControlCollection.Item[gridViewIndex]::ReadOnly to false
add 1 to gridViewIndex

end-perform.

compiler errors are: 

ControlCollection has no visible static member Count

type TextBox invalid operand

gridViewItem is invalid operand

looking for a way to loop through a Form.ControlCollection in visual cobol. Any solutions?

set netInt to type System.Windows.Forms.Control ControlCollection::Count.
set gridViewIndex to 0.

perform until gridViewIndex = netInt

if controlList[gridViewIndex]::GetType = type TextBox
set type System.Windows.Forms.Form ControlCollection.Item[gridViewIndex]::ReadOnly to false
add 1 to gridViewIndex

end-perform.

compiler errors are: 

ControlCollection has no visible static member Count

type TextBox invalid operand

gridViewItem is invalid operand

Something like this?

      perform varying ctrl as type Control thru self::Controls
           if ctrl::GetType = type of TextBox
|                set ctrl as type TextBox::ReadOnly to false
           end-if
      end-perform.