一个简单的显示问题 button 的单击事件 加入 TextBox1.Text = Button1.Text.Trim(); 应该可以 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 希望对你有所帮助private void button4_Click(object sender, EventArgs e) { this.textBox1.Text = (sender as Button).Text; //this.textBox1.Text = this.button4.Text; 这句话也是可以的,去什么两端的空格什么的,就都省掉了.... } 贴个简单的代码段供参考,button的事件都设为button1_click,另外textbox1的textalign选Right 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(); } } Button的点击事件中,设置文本框的Text属性等于 Button的Text就可以了撒 测试下怎么贴代码,原来google的chrome下回复的工具栏是看不到的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(); } } 写个公用事件给0-9数字按键,判断是1就textBox.Text+=1;这个似乎没什么说头了,按clean的时候直接textBox.Text=""; C# 怎么在静态类里面定义静态数组?? 有个关于DataGridView的问题,希望大家帮忙 C#程序登陆问题 问一个简单的lock问题 winform splitcontainer用一个按钮完成:一个panel收起,另一个最大化 关于dataset插入提交到数据库的问题 如何在a窗口中设置b窗口中莫个控件的属性 招人 请教GDI如何画旋转文字问题 一个低级问题! 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();
}
}