Page 1 of 1

Form.Location cannot be set

Posted: Fri Apr 27, 2007 7:06 pm
by grahama
[Using RanorexPro 1.1.0.0 in C# with .NET 2.0]

If I have a form, the following code works:

Code: Select all

Form form = ... some form ....
int x = form.Location.X;
But if I try to set the location, i.e.:

Code: Select all

form.Location.X = 5;
The compiler gives the error: Cannot modify the return value of 'Ranorex.Control.Location' because it is not a variable.

So how do I move a form?

Thanks.

Posted: Sat Apr 28, 2007 10:47 am
by webops
We have a set operator only for the Location, please set the new location as follows:

Code: Select all

Point location = form.Location;
location.X = 5;
form.Location = location;
or

Code: Select all

form.Location = new Point(5, form.Location.Y);
Jenö
Ranorex Team