views:

19

answers:

1

Dear reader,

My application allows the user to insert information into a document (using document properties and variables). Part of this is also that they should be able to adjust the values they have previously entered. Changing the Name and Value of a document property is no problem, but apparently the variable Name has a get property only, no set property. This is how I'm assigning a variable:

object v = _name;
Variables.Add(_sName, ref v);

This is how I'd ideally change the variable.

var.Name = newName;

But it gives an error saying:

Property or indexer 'Word.Variable.Name' cannot be assigned to -- it is read only

The only option I can think of is deleting the variable and creating a new one with the updated values. But is that really my only option?

A: 

I went ahead and solved it by simply changing the name and value of the document property, but also removing the variables and creating new ones with the updated values. As far as I know that's the only way to go about it.

Kevin van Zanten
You can go ahead and accept your own answer as the correct one.
Otaku
Good point, thanks for the reminder. The 10(?)-minute delay made me forget all about it.
Kevin van Zanten