按钮文本到文本框显示字符串 [英] button text to textbox display String

查看:54
本文介绍了按钮文本到文本框显示字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#窗口窗体中

我在窗口中有多个按钮,如果单击一个按钮,然后按钮文本显示到文本框中,如果单击第二次,它将从文本框中删除按钮文本????

In C# windows form
I have multiple Button in window form if click on one button then Button text display into textbox & if click second time it will remove button text from textbox ????

推荐答案

如果文本框中有任何文字,请清除文本框。



代码
Clear the text box if there is any text in it.

Code
button1_click(...)
{
  if (txtbox1.text == string.empty) 
      txtbox1.text = GetText();
  else
      txtbox1.text =string.empty; 
}


这篇关于按钮文本到文本框显示字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆