Adnan
asked on
specified cast is not valid when i delete the decimal amount value from my cell i datagridview
I get error message saying that the specified cast is not valid when i delete the decimal amount value from my cell i datagridview and click in another cell the error message shows upp saying that the specified cast is not valid....
The grid cell contain a decimal value 0.00 , and it happens when i delete value and click in another cell....
The grid cell contain a decimal value 0.00 , and it happens when i delete value and click in another cell....
if ( row.RowState != DataRowState.Detached)
if ((int)row.AccountRow.Type >= 128)
{
sumRegisteredRight += row.Amount; // ERROR ON THIS LINE
}
else
{
sumRegisteredLeft += row.Amount;
}
ASKER
Specified cast is not valid, when column returns NULL or is empety.....??
HELP PLEEAASSEEE...
HELP PLEEAASSEEE...
Your facing this problem due to nullable and type casting. Please follow the following discussion and solve your problem
http://www.developmentnow. com/g/36_2 008_2_0_0_ 1051275/Nu llable-typ es-giving- error.htm
http://www.developmentnow.
ASKER
here is the correct answer for my prob......thank anyway experts....HUHHHH
if ( row.RowState != DataRowState.Detached && row["Amount"] != DBNull.Value)
if ( row.RowState != DataRowState.Detached && row["Amount"] != DBNull.Value)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window