How to rewrite this code for Datagrid?
int sw1 = 0;
ids = string.Empty;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
if (dataGridView1[0, i].Value != null)
{
if (sw1 == 0)
{
sw1 = 1;
}
else
ids += ",";
ids += dataGridView1[0, i].Value.ToString();
}
}