Answered Validate Cell Value in Datagridview

  • Tuesday, December 12, 2006 9:11 PM
     
     

    Hi

    I have a datagridview where i manualy add rows and columns. But when the user tabs out of a specific cell i need to get the value and do a check. But i get blank.

    I'm using the following

    dgrdvGLTransLines.CellValidating +=new DataGridViewCellValidatingEventHandler(dgrdvGLTransLines_CellValidating);

    private void dgrdvGLTransLines_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)

    {

    if (e.ColumnIndex == 0)

    {

    string s=Convert.ToString(dgrdvGLTransLines.Rows[e.RowIndex ].Cells[e.ColumnIndex ].Value);

    }

    }

    It returns a blank value if i exit out of a cell i just typed in. If i click on that cell again, retype something else then tab out the cell i then get the first value and not the retyped value. Basically it seems it's checking the cell value before the cell has assigned itself the new value.

     

    How can i get around this??? When i tab out the cell i want the latest value.

     

    Thanks in advance

All Replies