public class MyTextBox : System.Web.UI.WebControls.TextBox { public override string Text { get { return base.Text; } set { // 验证代码 // ... // example validation case if(value != "csdn") thrown new Exception("请输入小写的csdn"); // ... base.Text = value; } }
public class usertxtbox : System.Windows.Forms.TextBox { public override string Text { get { return base.Text; } set { base.Text = value; } } }
{
public override string Text
{
get { return base.Text; }
set
{
// 验证代码
// ...
// example validation case
if(value != "csdn") thrown new Exception("请输入小写的csdn");
// ...
base.Text = value;
}
}
{
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
} }