C#编写的计算器退格键到头出错了 急~~~
textBox1.Text = textBox1.Text.Remove(textBox1.SelectionStart-1,1); 当退到头的时候程序就报错了~各位大大们 求帮忙~ --------------------编程问答-------------------- 加判断if(textBox1.Text.ToString().Trim().Length>0)
{} --------------------编程问答-------------------- 楼上正解 --------------------编程问答--------------------
--------------------编程问答-------------------- if(String.IsNullOrEmpty(TextBox1.Text))
if(textBox1.Text.ToString().Trim().Length>0)
{
textBox1.Text = textBox1.Text.Remove(textBox1.SelectionStart-1,1);
}
{
return;
}
else
{
//执行你上面的代码;
} --------------------编程问答-------------------- textBox1.Text.ToString() ? --------------------编程问答-------------------- if (textBox1.Text.Length > 0)
{
textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length - 1);
}
补充:.NET技术 , C#