want to get value of cell 0 of selected rows in 2 text boxes..there are 2 selected rows but in both text boxes i am getting value of only one selected row. help me with this, THANX
bool itemFound = false;
for(i=0;i<=dataGridView1.Rows.Count-1;i++)
{
if (dataGridView1.Rows[i].Cells[1].Value.ToString() == txtcscnic1.Text + "-" + txtcscnic2.Text + "-" + txtcscnic3.Text)
{
dataGridView1.Rows[i].Selected = true;
itemFound = true;
int j = dataGridView1.SelectedCells[0].RowIndex;
string str = dataGridView1.Rows[j].Cells[0].Value.ToString();
string[] gcnic;
gcnic = str.Split('-');
txtcnic1.Text = gcnic[0];
txtcnic2.Text = gcnic[1];
txtcnic3.Text = gcnic[2];
str = dataGridView1.Rows[j].Cells[0].Value.ToString();
gcnic = str.Split('-');
txtgcnic1.Text = gcnic[0];
txtgcnic2.Text = gcnic[1];
txtgcnic3.Text = gcnic[2];
}