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.
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.
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.
@henrialves
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:
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"))