Need to convert information in a data table to a Double type variable

Hello,

I have information multiple data tables that I am trying to convert into a Double variable to use for a calculation.

The method I am currently using involves pulling the top row of multiple data tables: (periodBalance2.Rows(0).Item(“period 2”).ToString)

and then converting it to a double within the calculation:
convert.ToDouble(creditLimit) -( (convert.ToDouble(periodBalance2Value) + convert.ToDouble(periodBalance3Value) + convert.ToDouble(periodBalance4Value) + convert.ToDouble(periodBalance5Value)))- (convert.ToDouble(orderBalance))

Each of the period balances come from their own data table, and when this calculation is run no matter what the values of the individual periods are, the calculation returns ‘0’ which is incorrect.

Does anyone have an easier/alternate method for this?

You might prefer Decimal type when dealing with money…

1 Like