一个按钮控制文本框的显示和隐藏 我的错在哪里???
namespace 11{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Visible = true;
textBox1.Visible = false;
}
}
}
public Form1() { InitializeComponent(); button1.Text = textBox1.Visible ? "显示" : "隐藏"; } private void button1_Click(object sender, EventArgs e) { textBox1.Visible = !textBox1.Visible; button1.Text = textBox1.Visible ? "隐藏" : "显示"; }