Sunday, November 29, 2009

Code For Backspacing

You can substring your string to its length - 1, e.g.
String input = "Hello.."; String output = input.Substring(0, input.Length - 1);
Console.WriteLine(output);
-------------------------------------------------------------------------------------------------

protected void Button1_Click(object sender, EventArgs e)
{
string s = TextBox1.Text;
string o;
o=s.Substring(0, s.Length - 1);
TextBox1.Text = o;
if (TextBox1.Text == "")
{
TextBox1.Text = "0";
}

}

No comments:

Post a Comment