0

I've got a problem with Visual Studio Designer's convention of setting the text in a TextBox to the name of the control. I've got a control that accepts a Social Security Number, and the Text property is overridden so as to throw an exception if the text is not in the correct format (e.g. 123-45-6789 or 123456789). When I try to use the control in the designer, this exception is thrown because Visual Studio is trying to name the control cssnTextBox1. Is there an attribute I can place on the Text property to prevent the designer from setting it?

Eric Andres
  • 3,417
  • 2
  • 24
  • 40

1 Answers1

0

Take a look at this discussion: how to detect design time in C# control.

http://vidmar.net/weblog/archive/2005/04/11/1246.aspx

You need to disable the Text property validation, if control's container is in design mode.

Alex F
  • 42,307
  • 41
  • 144
  • 212