Normally you can find the controls of a tab control also with the form find functions, there are in the client area:
Code: click into code to enlarge
CheckBox checkBoxInTab = form.FindCheckBox("checkBox3");
In V1.1.0, you will be able to find a child control in another control.
In V1.0.0 you can read all controls of a tab control as follows:
If you have the professional version:
Code: click into code to enlarge
// Get all controls of the tab
Form tabForm = new Form(tabControl.Handle);
tabForm.GetControls();
foreach (Control control in tabForm.Controls)
{
IntPtr handle = control.Handle;
Point location = control.Location;
Size size = control.Size;
String text = control.Text;
Console.WriteLine("Handle={0} Location={1} Text={2}", handle, location, text);
}
If not, than you can read all controls of the form and filter one:
Code: click into code to enlarge
// Get all controls of the form
form.GetControls();
foreach (Control control in form.Controls)
{
IntPtr handle = control.Handle;
Point location = control.Location;
Size size = control.Size;
String text = control.Text;
Console.WriteLine("Handle={0} Location={1} Text={2}", handle, location, text);
}
Please read also the following topic:
This works with elements, you can do the same in C#.
Access to control in Tabcontrol
Jenö Herget
Ranorex Team |