У меня проблема с представлением datagrid. Я хочу сопоставить все строки представления datagrid один за другим с определенным значением. Мой код приведен ниже, но это не работает:datagridview специальная проверка состояния
for(int i = 0; i < dataGridVie.RowCount;i++){
if(dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "F7" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}
for(int i = 0; i < dataGridVie.RowCount;i++){
if(dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "F3" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}
for(int i = 0; i < dataGridVie.RowCount;i++)
{
if( dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "T3" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}
for(int i = 0; i < dataGridVie.RowCount;i++)
{
if(dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "C3" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}
for(int i = 0; i < dataGridVie.RowCount;i++){
if(dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "T5" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}*/
/*for(int i = 0; i < dataGridVies.RowCount;i++)
{
if( dataGridVies.Rows[i].Cells[0].Value.ToString().Trim() == "O2" && dataGridVies.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}
/*for(int i = 0; i < dataGridVie.RowCount;i++){
if(dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "P2" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
count++;
}*/
if(count==4)
{
MessageBox.Show("");
}
не ясно, что вы пытаетесь достичь. дать дополнительную информацию или предоставить пример – Vland