By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,617 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

datagridview problem?

P: 1
i have problem in datagride view.i want to match all the rows of datagrid view rows one by one with specific value my code is given below it is not working ...
Expand|Select|Wrap|Line Numbers
  1. for(int i = 0; i < dataGridVie.RowCount;i++ ){
  2.                 if(    dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "F7" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave" )
  3.                     count++;}
  4.             for(int i = 0; i < dataGridVie.RowCount;i++ ){
  5.                 if(dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "F3" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave" )
  6.                     count++;
  7.  
  8.         }
  9.             for(int i = 0; i < dataGridVie.RowCount;i++ )
  10.             {
  11.  
  12.         if(  dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "T3" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave" )
  13.             count++;
  14.             }
  15.             for(int i = 0; i < dataGridVie.RowCount;i++ )
  16.             {
  17.                if(     dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "C3" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
  18.                    count++;}
  19.             for(int i = 0; i < dataGridVie.RowCount;i++ ){
  20.                  if(   dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "T5" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave" )
  21.                      count++;}*/
  22.          /*   for(int i = 0; i < dataGridVies.RowCount;i++ )
  23.             {
  24.  
  25.                   if(  dataGridVies.Rows[i].Cells[0].Value.ToString().Trim() == "O2" && dataGridVies.Rows[i].Cells[1].Value.ToString() == "slow wave" )
  26.                       count++;}
  27.           /*  for(int i = 0; i < dataGridVie.RowCount;i++ )
  28.             {if(      dataGridVie.Rows[i].Cells[0].Value.ToString().Trim() == "P2" && dataGridVie.Rows[i].Cells[1].Value.ToString() == "slow wave")
  29.                 count++;}*/
  30.             if(count==4)
  31.  
  32.                 {
  33.                     MessageBox.Show("");
  34.                 }
Aug 24 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.