Question

I have a combo box which contains two List Items. Each list item consists of a checkbox and a text message. Now, I am using a function which looks something like this to uncheck all the checkbox's within the combobox.

public ApplicationReports UnSelectAllCheckBox()
{
    int i = 0;
    ComboBox someVariable= Application.Library.GetFromWindow(Application.Configuration.LoginWindow.Title).OfType<ComboBox>("corresponding Automation Id");

    foreach (ListItem casino in someVariable.Items)                     
    {
        someVariable.Item(i).UnCheck();
        i++;
    }
    // someVariable.Item(0).UnCheck();
    return this;
}

I am able to uncheck the second checkbox using this approach but not the first one. Unable to identify what is the problem when it is working fine for the second list item. I am using the recently released version of white framework. "someVariable" is not a problem. I checked its retrieving the correct combo box while debugging.

No correct solution

OTHER TIPS

Try this instead:

foreach (ListItem casino in someVariable.Items)                     
{
    casino.UnCheck();
}

No need to use i and make your own loop iterator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top