Автор - MIRAMIX.
Код.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
namespace взаимодействие_textBox_и_Buttons { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.TextLength >= 1) { button2.Enabled = true; button3.Enabled = true; } else { button2.Enabled = false; button3.Enabled = false; } }
private void button1_Click_1(object sender, EventArgs e) { if (button1.CanSelect) { textBox1.Enabled = true; button4.Enabled = true; button1.Enabled = false; }
}
private void button2_Click_1(object sender, EventArgs e) { MessageBox.Show(textBox1.Text); }
private void button3_Click(object sender, EventArgs e) { if (textBox1.TextLength >= 1) { textBox1.Clear(); } }
private void button4_Click(object sender, EventArgs e) { if (button4.CanSelect) { textBox1.Enabled = false; button1.Enabled = true; button4.Enabled = false; } }
private void Form1_Load(object sender, EventArgs e) {
} } }
|