Retaining the UI variable between two operations
Posted: Tue Aug 09, 2011 9:20 am
Hi,
I am having a form and the form contains a text box. First I initalize a Text variable with the rx path of this textbox. And am getting the text in it correctly.
Next am closing the form through automation. Do some functions and open the same form again. I want the text value again. But this time instead of initializing a new textbox variable, am using the same variable which i had initialized earlier. But it is not giving me the text value in it. It always returns me empty. Kindly help. Am giving you the code here.
Form f = @"/form[@name='Copy']";
Text t = @"/form[@name='Copy']/text[@automationid='PART_Notional']";
Console.WriteLine(t.TextValue); //This line prints the correct value '20'
f.Close();
//Do some operations and open the same form again
Console.WriteLine(t.TextValue); //This line always prints empty even though it has value in it.
My question is, how to get the value in the Textvariable t, between closing the form and opening the form. If the form which contains the control is closed once, is it not possible to use the same control after opening the form?
Kindly Help
Regards,
Siva R S
I am having a form and the form contains a text box. First I initalize a Text variable with the rx path of this textbox. And am getting the text in it correctly.
Next am closing the form through automation. Do some functions and open the same form again. I want the text value again. But this time instead of initializing a new textbox variable, am using the same variable which i had initialized earlier. But it is not giving me the text value in it. It always returns me empty. Kindly help. Am giving you the code here.
Form f = @"/form[@name='Copy']";
Text t = @"/form[@name='Copy']/text[@automationid='PART_Notional']";
Console.WriteLine(t.TextValue); //This line prints the correct value '20'
f.Close();
//Do some operations and open the same form again
Console.WriteLine(t.TextValue); //This line always prints empty even though it has value in it.
My question is, how to get the value in the Textvariable t, between closing the form and opening the form. If the form which contains the control is closed once, is it not possible to use the same control after opening the form?
Kindly Help
Regards,
Siva R S