C
Carlo Goretti
Guest
Hey!
Im doing an app that contains some checkboxes. I want to make that if you check the first checkbox. Then the other checkboxes get checked to. But if you check out someone of the other checkboxes then, the first one will be unchecked because not everyone are checked! but if you check the unchecked one again then the first one will be checked again! Sorry for my bad english..
void checkboxeAll_CheckedChanged(object sender, EventArgs e)
{
//for(int i = 0; i < checkBoxesList.Count(); i++)
//{
// if (checkBoxesList.Checked == true)
// {
// return;
// }
//}
if (checkboxeAll.Checked == true && test2 == false)
{
for (int i = 0; i < checkBoxesList.Count(); i++)
{
checkBoxesList.Checked = true;
//MessageBox.Show(checkBoxesList.Checked.ToString());
ÄndraTillLista.Text = ÄndraTillLista[0].Text;
}
test = true;
}
//if (checkboxeAll.Checked == true && test2 == true)
//{
// for (int i = 0; i < checkBoxesList.Count(); i++)
// {
// break;
// // checkBoxesList.Checked = true;
// //MessageBox.Show(checkBoxesList.Checked.ToString());
// //ÄndraTillLista.Text = ÄndraTillLista[0].Text;
// }
// test = true;
//}
//test = true;
//else if (checkboxeAll.Checked == false)
//{
// for (int i = 0; i < checkBoxesList.Count; i++)
// {
// checkBoxesList.Checked = false;
// }
//}
}
void textBoxes2_TextChanged(object sender, EventArgs e)
{
if (checkboxeAll.Checked == true)
{
if (TaBort == true)
{
for (int i = 0; i < ÄndraTillLista.Count(); i++)
{
if (checkBoxesList.Checked == true)
{
ÄndraTillLista.Text = ÄndraTillLista[0].Text;
}
}
}
}
else
{
if (TaBort == true)
{
for (int i = 0; i < ÄndraTillLista.Count(); i++)
{
if (checkBoxesList.Checked == true)
{
ÄndraTillLista.Text = ÄndraTillLista[0].Text;
}
if (checkBoxesList.Checked == false)
{
}
}
}
}
if (ÄndraTillLista[0].Text == "")
{
checkBoxesList[0].Checked = false;
}
else
{
checkBoxesList[0].Checked = true;
}
}
void checkboxes_CheckedChanged(object sender, EventArgs e)
{
for (int i = 0; i < checkBoxesList.Count(); i++)
{
if (checkBoxesList.Checked == false && test == true)
{
checkboxeAll.Checked = false;
}
//else if (checkBoxesList.Checked == true && test == true)
//{
// test2 = true;
// checkboxeAll.Checked = true;
//}
}
Have tried many ways but cant get it to work..
Continue reading...
Im doing an app that contains some checkboxes. I want to make that if you check the first checkbox. Then the other checkboxes get checked to. But if you check out someone of the other checkboxes then, the first one will be unchecked because not everyone are checked! but if you check the unchecked one again then the first one will be checked again! Sorry for my bad english..
void checkboxeAll_CheckedChanged(object sender, EventArgs e)
{
//for(int i = 0; i < checkBoxesList.Count(); i++)
//{
// if (checkBoxesList.Checked == true)
// {
// return;
// }
//}
if (checkboxeAll.Checked == true && test2 == false)
{
for (int i = 0; i < checkBoxesList.Count(); i++)
{
checkBoxesList.Checked = true;
//MessageBox.Show(checkBoxesList.Checked.ToString());
ÄndraTillLista.Text = ÄndraTillLista[0].Text;
}
test = true;
}
//if (checkboxeAll.Checked == true && test2 == true)
//{
// for (int i = 0; i < checkBoxesList.Count(); i++)
// {
// break;
// // checkBoxesList.Checked = true;
// //MessageBox.Show(checkBoxesList.Checked.ToString());
// //ÄndraTillLista.Text = ÄndraTillLista[0].Text;
// }
// test = true;
//}
//test = true;
//else if (checkboxeAll.Checked == false)
//{
// for (int i = 0; i < checkBoxesList.Count; i++)
// {
// checkBoxesList.Checked = false;
// }
//}
}
void textBoxes2_TextChanged(object sender, EventArgs e)
{
if (checkboxeAll.Checked == true)
{
if (TaBort == true)
{
for (int i = 0; i < ÄndraTillLista.Count(); i++)
{
if (checkBoxesList.Checked == true)
{
ÄndraTillLista.Text = ÄndraTillLista[0].Text;
}
}
}
}
else
{
if (TaBort == true)
{
for (int i = 0; i < ÄndraTillLista.Count(); i++)
{
if (checkBoxesList.Checked == true)
{
ÄndraTillLista.Text = ÄndraTillLista[0].Text;
}
if (checkBoxesList.Checked == false)
{
}
}
}
}
if (ÄndraTillLista[0].Text == "")
{
checkBoxesList[0].Checked = false;
}
else
{
checkBoxesList[0].Checked = true;
}
}
void checkboxes_CheckedChanged(object sender, EventArgs e)
{
for (int i = 0; i < checkBoxesList.Count(); i++)
{
if (checkBoxesList.Checked == false && test == true)
{
checkboxeAll.Checked = false;
}
//else if (checkBoxesList.Checked == true && test == true)
//{
// test2 = true;
// checkboxeAll.Checked = true;
//}
}
Have tried many ways but cant get it to work..
Continue reading...