문제

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.

올바른 솔루션이 없습니다

다른 팁

Try this instead:

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top