All pastes #294667 Raw Edit

Something

public text v1 · immutable
#294667 ·published 2006-12-28 18:49 UTC
rendered paste body
        //-- function used to highlight a specific row
        public void FindDataRow(DataGridView myDataGrid, int iColIndex, string sColValue)
        {
            /* check to make sure we have a value */
            if (myDataGrid != null && sColValue.Length > 0)
            {
                int iRow;
                /* loop through the collection and check the value */
                for (iRow = 0; iRow < myDataGrid.RowCount; iRow++)
                {
                    string myValue = myDataGrid[iColIndex, iRow].Value.ToString();
                    if (myValue == sColValue)
                    {
                        myDataGrid.Rows[iRow].Selected = true;
                        myDataGrid.Rows[iRow].Cells[iColIndex].Selected = true;

                        break;
                    }
                }
            }