Variable1 = row.Item(3).ToString
Variable1 contains "17,757.00"
Variable1 = Variable1.Replace(",","")
This step gives me the error:
Variable2 = convert.ToInt32(Variable1)
Variable2 is of type Int32.
Variable1 = row.Item(3).ToString
Variable1 contains "17,757.00"
Variable1 = Variable1.Replace(",","")
This step gives me the error:
Variable2 = convert.ToInt32(Variable1)
Variable2 is of type Int32.
an int cannot contain a dot. Via a double this value can be converted into an int.
Have a look below
on last line take a note on the out of the box roundings
you have decimal places in string, int does not have decimail places.
either convert to decimal or remove .00 from string
@ppr @TimK Thank you both, I added one extra step:
Variable1 = row.Item(3).ToString
Variable1 contains “17,757.00”
Variable1 = Variable1.Replace(",","")
VariableDec = convert.ToDecimal(Variable1) <---
Variable2 = convert.ToInt32(VariableDec)
Hello,
The output for the your problem would be
String Variable1 = “17757.00”
Cint(Convert.ToDouble(Variable1)) = 17757
After conversion into an Integer Decimal number will be removed.