I try to change the type of a module variable from String (default) to Int32.
I know I could change it if I use the variable as argument in a method via F4, but I assign the value to the variable via return from the method. When I click F4 on this piece of usercode, it shows me the variable, but no choice to change the type of the variable. The returntype of the method is also int.
When I run the method it tells me you can't convert from Int to String which is logic, but where can I change the type of a module variable never used as argument in a method?
Type of module variables
Re: Type of module variables
Hi,
I'm afraid, the module variables are, by design, always "strings". The only way to achieve what you want is to convert the string variable to int prior using it in your method. You can do this for example by using Int32.Parse or Int32.TryParse.
I'm afraid, the module variables are, by design, always "strings". The only way to achieve what you want is to convert the string variable to int prior using it in your method. You can do this for example by using Int32.Parse or Int32.TryParse.
Code: Select all
//Parse
int varOut = Int32.Parse(moduleVar);
//TryParse
bool result = Int32.TryParse(moduleVar, out varOut);
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration