Converting string to double

Posted by Sushilkumar.sush under C# on 6/3/2011 | Points: 10 | Views : 26094 | Status : [Member] | Replies : 3
Hi all ,
Urgert Need the help for converting String value to Double..
I have written code for that and its working .but my problem is like in my project we are using multiple language i.e German,Spanish .
When i m chaging the language and trying to convert the string value into double then its show Error i.e input string was not in Correct Format

My Code :

1) Double ObjAvCash = Double.Parse(lblAvailableCashValue.Text.ToString());
2) double ObjAvCash = Convert.toDouble(lblAvailableCashValue.Text.ToString());

its working .
But Its not working when user change the language.
Please Help Me ...

Thanks In Advance.......

Sushilkumar Shinde


Responses

Posted by: A4u6178 on: 6/4/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

refer the following link ..
http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/2dfb0a7c-2134-4308-ba07-4696044dc357

Thanks & Regards;
aaa

Sushilkumar.sush, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 6/7/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

Refer this,

http://www.java2s.com/Code/ASP/Development/ConvertstringtodoubleVBnet.htm

Regards,
Susan

Sushilkumar.sush, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gsolvers on: 6/7/2011 [Member] Starter | Points: 25

Up
0
Down
use the below

double d = double.Parse(lblAvailableCashValue.Text.ToString(), System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture);

Best Regards,

VG
www.TeacherJi.com

Sushilkumar.sush, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response