开发者

How to make a textbox empty in code behind

开发者 https://www.devze.com 2023-01-11 19:29 出处:网络
I have a textbox (txtbox1) which has some value in it. I want to em开发者_如何学Pythonpty the value of textbox. Is that possible in code behind? If yes, how?

I have a textbox (txtbox1) which has some value in it. I want to em开发者_如何学Pythonpty the value of textbox. Is that possible in code behind? If yes, how?

Thanks!


Well:

txtbox1.Text = "";

should do it.

(Note that I generally prefer "" to string.Empty in terms of readability. Use whichever you prefer. Ignore any talk about the performance differences between them - most articles I've seen on this are out of date, and any performance difference there might be will be entirely insignificant.)


txtbox1.Text = string.Empty;


use textbox1.Text = null; you can also use textBox1.Text = "";

if you want to put strings in the future textBox1.Text = string.Empty;

0

精彩评论

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