日期:2014-05-17 浏览次数:20879 次
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)8
------解决方案--------------------
e.KeyChar == (char)46)
{
this.textBox1.Text = "1";
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.TextChanged+=new EventHandler(textBox1_TextChanged);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text != "1")
{
textBox1.Text = "1";
}
}
}