Just pass the proper parameters to the method and the method finds the proper checkbox.omayer wrote:Hi Ciege,
if page contains 10 different checkboxes and all 10 checkboxes has diff control name, so when i call the function clickcheck w/passing controlname as parameter, how does it work ...shouldn't i have to create 10 different functions to get the object name then passing to the caller, any input please.
Beginner
Code: Select all
public static int CheckBoxClick(Boolean SelectCheckBox, Ranorex.Form RanorexFormName, String CheckBoxName)
RanorexFormName - pass the Ranorex.Form element that your checkbox lives on. The method will search this form for the checkbox.
CheckBoxName - pass the controlname or text of the checkbox. The method will search for the element with this controlname or text.
So in your case, you have 10 different checkboxes on the same form. Assume you want to set them all to true and assume you are searching the same form for each. Just call the method 10 times with the different controlname of the checkbox.
I.e.
Code: Select all
intResult = CheckBoxClick(True, MyForm, "CheckBox1")
intResult = CheckBoxClick(True, MyForm, "CheckBox2")
intResult = CheckBoxClick(True, MyForm, "CheckBox3")
etc...