Change text dot's text programmatically

Hi, I’m trying to change the text in text dots using the C# component. This is what I have. When I run it, the text dots do not change. Any ideas about what I’m doing wrong?

private void RunScript(bool activate, Guid x, string y, ref object A)
Rhino.DocObjects.ObjRef objref = new Rhino.DocObjects.ObjRef(x);
Rhino.Geometry.TextDot dot = objref.TextDot();
string dotText = dot.Text.Substring(1, 2);
dotText = y + dotText;
dot.Text = dotText;
A = dot.Text;

Not an expert but it seems that “dot” in a new object because if I add that
I get a new TextDot.

Laurent, thank you. Any idea how to get to the existing dot to change its .Text property? Maybe using ObjRef is the wrong approach?

Maybe using this:

Something that seems to work

Rhino.DocObjects.ObjRef objref = new Rhino.DocObjects.ObjRef(x);
Rhino.DocObjects.TextDotObject dotObject = objref.Object() as Rhino.DocObjects.TextDotObject;
TextDot tdot = dotObject.Geometry as TextDot;
tdot.Text = y+ tdot.Text.Substring(1, 2);

Based on

See attached as well (121.0 KB)