开发者

Textbox, delete button [c#]

开发者 https://www.devze.com 2023-02-15 14:12 出处:网络
to add new letter to textbox i use Textbox.Text = Textbox.Text + \" \"; adds space etc., its simple but i didnt figured out how can i delete last line

to add new letter to textbox i use

Textbox.Text = Textbox.Text + " ";

adds space etc., its simple

but i didnt figured out how can i delete last line

for examp.

text of textbox is abcdefg

and when user clicks delete, text is "abcdef" then "adcde"开发者_Python百科 etc.

how can i do this ?

i tried to search the web but i failed because i dont know how to search that such a thing ^^


String text = Textbox.Text;
if(!String.IsNullOrEmpty(text))
    Textbox.Text = text.Substring(0,text.Length-1);


  TextBox.Text = TextBox.Text.Remove(str.Length - 1, 1);
0

精彩评论

暂无评论...
验证码 换一张
取 消