button 的单击事件 加入 TextBox1.Text = Button1.Text.Trim(); 应该可以
解决方案 »
- C#编程:关于“输入字符串的格式不正确”问题
- 收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 想用linq to xml 修改App.config的节点值,求指点
- 》》》》》》》》》》》》》winform嵌入操作excel的问题
- 数据类型转换的问题!
- 如何将一个事件的方法传递给另一个事件? 或取消该事件所对应的方法?
- 在C#中调试用F11逐语句调试,有的能进入函数,但有的没有 就象用F10一样?为什么?
- 关于合法性检查,高手请进!
- 一个真正需要有经验才能解决的问题。
- 界面问题
- 大位们帮我看看这个程序,好吗?谢谢!
- Listview如何快递全选?
- IHTMLWindow2调用滚动方法,如何确定滚动的距离或者当前滚动条的位置
private void button4_Click(object sender, EventArgs e)
{
this.textBox1.Text = (sender as Button).Text;
//this.textBox1.Text = this.button4.Text; 这句话也是可以的,去什么两端的空格什么的,就都省掉了....
}
public partial class Form1 : Form
{
StringBuilder sb = new StringBuilder();
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
sb.Remove(0,sb.Length);
sb.Append(textBox1.Text.Trim());
Button btn = sender as Button;
string buttonID = btn.Name.ToString();
switch (buttonID)
{
case "button1":
sb.Append("1");
break; case "button2":
sb.Append("2");
break; case "button3":
sb.Append("3");
break; }
textBox1.Text = sb.ToString();
}
}
{
StringBuilder sb = new StringBuilder();
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
sb.Remove(0,sb.Length);
sb.Append(textBox1.Text.Trim());
Button btn = sender as Button;
string buttonID = btn.Name.ToString();
switch (buttonID)
{
case "button1":
sb.Append("1");
break; case "button2":
sb.Append("2");
break; case "button3":
sb.Append("3");
break; }
textBox1.Text = sb.ToString();
}
}