I have 100 checkbox in a winfrom. Their name is sequential like checkbox1,checkbox2 etc. I have a submit button in my winform. After clicking the submitting button, it check
This is the write answer for this................
c#
string movie="";
if (checkBox1.Checked == true)
{
movie=movie+checkBox1.Text + ",";
}
if (checkBox2.Checked == true)
{
movie=movie+checkBox2.Text + ",";
}
if (checkBox3.Checked == true)
{
movie=movie+checkBox3.Text + ",";
}
if (checkBox4.Checked == true)
{
movie = movie + checkBox4.Text + ",";
}
if (checkBox5.Checked == true)
{
movie = movie + checkBox5.Text + ",";
}
if (checkBox6.Checked == true)
{
movie = movie + checkBox6.Text + ",";
}
row["EnquiryFor"] = movie.ToString();
where row is a object of DataRow and EnquiryFor is the name of sql table column....