Highlighted
Absent Member.
Absent Member.
530 views

looping through control

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: looping through control

Jump to solution

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.

View solution in original post

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: looping through control

Jump to solution

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.

View solution in original post

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.