Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good morning to everyone. I have written a program which include a textbox and two button using C#. Of those two buttons, one is to clear the values in the textbox. But the problem is that i have to clear the last one digit in the textbox. How i have to do this? Please give the answer.
Posted

I suggest buying a VERY basic book on C#. You're just going to keep getting stuck otherwise.

The Text property of the Textbox returns a string. It has a Length property, and a SubString method. That's all you need to know.
 
Share this answer
 
There's one book you should get, C# for Dummies, is a really good book for beginners like you, it will take you through the basics of C#, other book is "Sams Teach Yourself the C# Language in 21 Days", very good for people with no skills at all with C#.
 
Share this answer
 
Easiest way - do a Substring() on the string in the text box and reassign it to the text.

txtString.text = txtString.text.Substring(0,txtString.text.length -1);

However, as is suggested earlier, you should read a book to get these basics clear.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900