Hi
Thank you for your response. I tried the piece of code you posted, I still have the exception raised in Convert.ToSingle(s). Then I commented Convert.ToSingle(s) and the TryParse() was successful, when I had the hardcoded string as "0".
But the TryParse() is not successful with the datagridview input as "0". Here is the piece of code, which is giving me the issue:
private void LKDataGridView_CellValidating(object sender,
DataGridViewCellValidatingEventArgs CellEvent)
{
Single TempFloatVal = 0.0f;
switch ((ELKCol) CellEvent.ColumnIndex)
{
case ELKCol.Delta:
if (Single.TryParse(CellEvent.FormattedValue.ToString(),
out TempFloatVal))
MessageBox.Show("Value of Delta: " +
TempFloatVal.ToString());
else
MessageBox.Show("Input value: " +
CellEvent.FormattedValue.ToString());
break;
default: break
}
}
The data type for "Delta" is float. Any time i have non-zero numeric value entered for Delta in datgridview, Single.TryParse() succeeds. Any time I enter a 0 value for Delta in datgridview, Single.TryParse() fails.
I just am not able to figure out what is going on. Any suggestions is very much appreciated!
Thanks
K