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?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
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.