b h

b h

  • NA
  • 11
  • 0

Focus on row/colun

Jan 4 2007 4:40 PM
 

First of all, I am using VS 2003.  I am validating column values in a datagrid in the following fashion.

If I find an error, I want to set the focus on the row/column of that value.  I am having trouble with this.  Any suggestions?

 

foreach(DataRow currentRow in insertedTable.Rows)

{

foreach(DataColumn currentColumns in insertedTable.Columns)

{

string columnName = currentColumns.ColumnName;

object columnValue = currentRow[currentColumns];

switch(columnName)

{

       case "CLIENT_CD":

            if (currentRow[currentColumns] == DBNull.Value)

            {

                 currentRow[currentColumns] = clientText;

             }

            else

             {

                      MessageBox.Show("Craft Code Exists!", "Craft Code Already Exists. ", MessageBoxButtons.OK,MessageBoxIcon.Error);

                      Here is where I want to set the focus on the row/column <------------------------------------

            }

           break;