Friends, such a task. There is a form on which there are two textBox
elements and 1 button
element. Initially, the button
element is not active. It should become active only when at least 1 character appears in the textBox
elements. I did it this way, using two checkboxes.
public partial class Form1 : Form { bool tb1 = false; bool tb2 = false; public Form1() { InitializeComponent(); } private void textBox1_TextChanged(object sender, EventArgs e) { tb1 = true; if ((tb1 == true) && tb2 == true) button1.Enabled = true; } private void textBox2_TextChanged(object sender, EventArgs e) { tb2 = true; if ((tb1 == true) && tb2 == true) button1.Enabled = true; } }
But I am sure that with the help of delegates and events this task can be solved much more beautifully, but I did not understand how. I would be grateful if someone tells you.
(tb1 == true) && tb2 == true
bytb1 && tb2
, the logical variables themselves can be used in conditions. - rdorn