Overloaded Form.Find functions with ControlId?
Posted: Fri Sep 08, 2006 3:49 pm
We use some old windows dialogs and search the controls with Form.FindControlId().
This function returns a generic control type and we must cast to the correct class:
It would be easier for us to use overloaded function like FindRadioButton (controlId).
This function returns a generic control type and we must cast to the correct class:
Code: Select all
Control control = form.FindControlId(102);
if (control is RadioButton)
{
RadioButton radio = (RadioButton)control;
Mouse.MoveToControl(radio);
radio.Checked = true;
}
Code: Select all
RadioButton radio = form.FindRadioButton(102);
if ( radio != null )
{
Mouse.MoveToControl(radio);
radio.Checked = true;
}