TryParse和ConvertToDouble无法在带有组合框的Windows平板电脑上运行 [英] TryParse and ConvertToDouble not working on windows tablet with combobox

查看:33
本文介绍了TryParse和ConvertToDouble无法在带有组合框的Windows平板电脑上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段代码在Windows笔记本电脑/台式机上工作正常



但是在平板电脑上运行时我得到错误:字符串格式不正确与Convert.ToDouble()。



代码是:



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:

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


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

               }





组合框保存值,例如:



0.00

0.10

0.20

0.30

0.40

0.50

0.60

0.70

0.80

.........

用户无法手动输入值。 combobox.DropDownStlye设置为DropDown。



正如在PC上运行时提到的那样工作正常但在Windows平板电脑上出错。



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.

推荐答案

我认为你应该使用 ComboBox.SelectedText 属性 [ ^ ]。
I think you should be using ComboBox.SelectedText Property[^].


这篇关于TryParse和ConvertToDouble无法在带有组合框的Windows平板电脑上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆