Forum Discussion

nittynair's avatar
nittynair
Occasional Contributor
14 years ago

Checkbox property - make it constant for a large set of checkboxes in a grid

Hi,



In my application I have a pop up window with a list of checkboxes in grid format.

I need to check a box according to user input .



The check statement looks like "Call Aliases.IEXPLORE.pageJobTitleWindow.formFrmjobtitles.panel.table.cell.panel.tableGvjobtitle.cell3.checkboxChkselecter.ClickChecked(True)the "cell3" value  changes for every checkbox .



Currently I am using a switch statement and using that for each checkbox ... but this is cumbersome as I have 98 checkboxes.



How can I make this work in a single statement.



thanks in advance
  • Hi,


    You can first find all cells with check boxes by using the FindAll method. This method will return an array of all found cells. Then, you can create a loop to obtain a child object of each cell object in the array and call the ClickChecked method of this object (the object corresponds to the check box). For example:




    Dim cells, checkbox


    cells = Aliases.IEXPLORE.pageJobTitleWindow.formFrmjobtitles.panel.table.cell.panel.tableGvjobtitle.FindAll("tagName", "TH", 5)

       If UBound(cells) >= 0 Then

       For i = 0 To UBound(cells)

          Set checkbox = cells(i).Child

          If checkbox.Exists Then

             checkbox.ClickChecked(True)

          End If

          Next

       Else

        Log.Warning("No cells found.")

      End If