else if (chekAll.Checked == false)
{
try
{
List<string> list = new List<string>();
foreach (var item in checkedListBox1.CheckedItems)
{
list.Add(item.ToString());
}
DataTable table = new DataTable();
for (int i = 0; i < list.Count; i++)
{
table.Columns.Add(list[i].ToString(), typeof(string));
}
foreach(DataGridViewRow row in dgOne.Rows)
{
bool isSelected = Convert.ToBoolean(row.Cells["Column0"].Value);
if (isSelected)
{
DataRow rowitem = table.NewRow();
int count = 0;
for (int i = 0; i < list.Count; i++)
{
if ("Serial No" == list[i])
{
count = 1;
}
else if ("Register No" == list[i])
{
count = 2;
}
else if ("Exam No" == list[i])
{
count = 3;
}
else if ("Acedemic Year" == list[i])
{
count = 4;
}
else if ("Full Name" == list[i])
{
count = 5;
}
else if ("Name with Initial" == list[i])
{
count = 6;
}
else if ("Course" == list[i])
{
count = 7;
}
else if ("Address" == list[i])
{
count = 8;
}
else if ("Telephpne No" == list[i])
{
count = 9;
}
else if ("Province" == list[i])
{
count = 10;
}
else if ("District" == list[i])
{
count = 11;
}
else if ("AGA Division" == list[i])
{
count = 12;
}
else
{
count = 13;
}
rowitem[i] = row.Cells[count].Value.ToString();
}
table.Rows.Add(rowitem);
}
dgTwo.DataSource = table;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.ToString());
}
}