Problem when modify robtarget through C#

Dear All,

I’m doing a project which using C# to communicate with robot. I need to change the coordinate of the robot according of the input from customer. This is my first project with the pc sdk. Now I can read robtarget value and change “pos” value. But when I write back to rapid data it come out “An argument specified by the client is not valid for this type of operation.” Please advice. Thanks

Here is my code:

scanner.Scan();
ControllerInfoCollection controllers = scanner.Controllers;
controller = new Controller(controllers[0]);

RobTarget rt = new RobTarget();
RapidData rp = controller.Rapid.GetRapidData(“T_ROB1”, “MainModule”, “pA2”);

if (controller.OperatingMode == ControllerOperatingMode.Auto)
{
using (Mastership m = Mastership.Request(controller.Rapid))
{
rt = (RobTarget)rp.Value;
rt.FillFromString2(“[[342.7,120,289.71],[0.593903,-0.243372,-0.657579,-0.394511],[0,-1,2,0],[8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09]]”);
rp.Value = rt; //Error here
}
}
else
{
MessageBox.Show(“Automatic mode is required.”);
}
}

catch (System.InvalidOperationException ex)
{
MessageBox.Show("Mastership is held by another client. " + ex.Message);
}
catch (System.Exception ex)
{
MessageBox.Show("Unexpected error occurred: " + ex.Message);
}

De RobTarget “pA2” has to be PERS and not CONST, is that the case?