Im wondering how I would reveal a label, and a textbox once a checkbox has been checked.
I know in my project, everything below initialize component starts once the form is visible, so i try this.
public Form2()
{
InitializeComponent();
if (checkBox1.Checked == true)
{
label9.Visible = true;
textBox4.Visible = true;
}
else
{
label9.Visible = false;
textBox4.Visible = false;
}
}
but that doesnt work, and so i put it in a while(true) loop, which is just an infinite loop
public Form2()
{
while (true)
{
InitializeComponent();
if (checkBox1.Checked == true)
{
label9.Visible = true;
textBox4.Visible = true;
}
else
{
label9.Visible = false;
textBox4.Visible = false;
}
}
}
but that doesnt work either, if someone knows the answer, please let me know :).
Aucun commentaire:
Enregistrer un commentaire