RichTextbox.Name question

Hi,

Howcome that every time I want to give my RichTextbox a Name I get an error

I want to set the an id as the name of it. Something like...
rtxt.Name = zone.Id.ToString();
Id is an integer like 1 or 326

Even when I'm trying to set the code of the zone as the name, I get that error
Code is a string like "West-Flanders"

The error I get in both cases is...
"Exception has been thrown by the target of an invocation."

Please help


Answer this question

RichTextbox.Name question

  • mduffin

    Name must start with a letter or an underscore and can contain only letters, digits, or underscores.

    You can use something like "West_Flanders" instead of "West-Flanders"


  • KyleT

    My RichTextbox is now in a stackpanel together with a rectangle. So now I'm trying to set the name property of the stackpanel and that doesn't go either.

    I guess the .Name property of a certain control can't take number values or symbols like "-". Is this a bug, or has it a purpose

    For the moment, can I do something about that I only have a unique Id (number-value) and a unique Zone (symbol value like "West-Flanders")

    thanks in advance,
    Kimme

  • RichTextbox.Name question