Tima'a Tamim Tima'a Tamim - 28 days ago 5x
C# Question

How to refer to a cell in data grid view using its index in C#

I have a purchase bill form in which the sold items must appear with their elements one of that element is the unit each time I will save the bill in the database each rows of the data grid view must check the unit text to make decisions on some conditions ... so how to refer to that cell in a condition where its index is 2

I tried to write it like this but it doesn't give any sense


can any one give the syntax for referring to the cell in the data grid view .. regards


Very simple

if ( pBilldgv.Rows[index of your row].Cells[index of your cell or 2].Value.ToString() )
    // Do what ever you want to do.

The index cell is the column index or in another way the intersection of a row and a column will give you a cell.