0
我有个任务,使按钮活跃后经过两个文本框填充和 文件路径字符串不是空电量三条的bool是真正的制作按钮是真实
public bool isFileOpened = false;
public bool isDrive = false;
public bool isPrice = false;
他们正在成为真正的
private void textBox1_TextChanged(object sender, EventArgs e) {
drive = CheckIntInput(sender, "not valid");
if (drive != 0) {
isDrive = true;
}
}
private void textBox2_TextChanged(object sender, EventArgs e) {
price = CheckIntInput(sender, "not valid");
if (price != 0) {
isPrice = true;
}
}
private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e) {
filePath = openFileDialog1.FileName;
label1.Text = filePath;
isFileOpened = true;
}
CheckIntInput
方法从文本框或0返回号码,如果倾斜字符串转换为编号
,我怎么能实现的东西LIK E本:
if (isFileOpened && isDrive && isPrice) {
showButton.Enabled = true;
}
我要让按钮立即启动所有三个布尔变量之后变为真实的,theese三个字段可以以不同的方式输入,如
- TextBox1的
- TextBox2中
- openfiledialog1
or
- TextBox1的
- openfiledialog1
- TextBox2中