Creating an IF statement for datagrid value

Posted by EvanRyan on Stack Overflow See other posts from Stack Overflow or by EvanRyan
Published on 2010-05-30T22:39:59Z Indexed on 2010/05/30 22:42 UTC
Read the original article Hit count: 225

Filed under:
|
|
|
|

This is something I thought would be easier than it's turning out to be. For whatever reason, I can't seem to figure out a way to make what I'm trying to do here work with an If statement:

  List<int> miscTimes = new List<int>();

            for (int i = 0; i < MISCdataGridView1.RowCount; i++)
            {
                if (MISCdataGridView1.Rows[i].Cells[2].Value == "Something")
                {
                    miscTimes.Add(Convert.ToInt32(MISCdataGridView1.Rows[i].Cells[3].Value));
                }
            }
            return miscTimes;

For some reason, I can't get it to like anything I do with the if statement. I've tried converting to string and all of that. How should I go about this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about datagrid