Create variable with double value

Hi Guys, I’m Brazilian, so my english is not good, i will try to explain my question.

Here in Brazil the number format for financial value is like “X.XXX,XX” … The comma character separates cents to our currency, so i can’t ignore these numbers, but when i declare the variables the system shows error “StringConverter cannot convert from System.Double”.

I guess the variable type is wrong, but i dont know what type i will use in this case.

Please somebody could try to explain how to work with double values?

Again, i’m sorry for my language mistakes.

Find attached an flowchart with the example of what i’m looking for. (8.2 KB)

Check this topic

or to be exact:

Example :- Value1 = $450.65
Value 2 = $540.54

Store the values as a string . then use convert.ToDouble(Value1) and let us know.

We have tries in our application once and its working fine

Sorry Missed out a thing. Use regex to remove the $ symbol

Men, i read the related post, i already try to use the replace function in many ways and the error continues.

I think I did not express myself well, I doesn’t want to convert the number in financial value, i need the variable to read de decimal value in excel plain, but i can’t ignore the decimal number after the comma, because i need the cents.

i.e.: I have in the excel file like 0.000,00 and i need the value outputed the same 0.000,00

So, to explaing better, i need a decimal variable that is what i’m not getting.

1 Like


I guess the problem is that in Brazil we use comma to separate decimal number, we don’t use dot for this.

In the excel plain I do not have the $ character, just number separate by comma, and the system show me error when I try to read the value.



So you mean to say you need value after comma also (00.00,00) ? .

Not exactly, I attached a example.

The value is a cost of my service, but I receive the plain with this field in decimal format and i want to upload this number in decimal format with comma.

The first dot is not necessary (0000,00)

Follow attached (8.2 KB)

you need to use the locale for Brazilian Portuguese when you parse the numbers. Strip away the currency sign and then parse the String with the CultureInfo set to “pt-BR” and it will swap the commas and decimals according to the Brazilian locale rules. Check to make sure System.Globalization is in your imports.
Screenshot of it working in my studio:

Did you solve it? Same issue here…

Dont use double for this, use Decimal type instead, like if your string is this: 1.000,00, create a variable of type Decimal as varMeuValor and assign like this:
varMeuValor = Convert.ToDecimal("1.000,00", New System.Globalization.CultureInfo("pt-BR"))


Helped a Lot Thanks !!

1 Like