Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a piece of code that works fine on a windows laptop/desktop

but when running on tablet I get the error: string not in the correct format with Convert.ToDouble().

code is:

C#
double parseOut = 0;
               double.TryParse(this.comboBox1.Text, out parseOut);


               if (parseOut > 0)
               {
                   Double a = Convert.ToDouble(this.comboBox1.Text);
                   Double b = parseOut;

               }


the combobox holds values, examples:

0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
.........
the user cannot manually enter in the value. combobox.DropDownStlye set to DropDown.

As mentioned when running on PC it works fine but gives error on windows tablet.
Posted
Comments
johannesnestler 8-Nov-13 6:59am    
I'd guess: A localization problem (other Input language used?) So maybe use something like Convert.ToDouble(stringToConvert, System.Globalization.CultureInfo.CurrentCulture); (or CurrentUICulture, or a specific culture you want to use...)

1 solution

I think you should be using ComboBox.SelectedText Property[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900