运行应用程序Winform时出错 [英] Error in running application winform

查看:71
本文介绍了运行应用程序Winform时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出现此消息:无法将参数值从字符串转换为双精度.
我写这句话时如何解决

This message appears: Failed to convert parameter value from a String to a Double.
How to solve it when i write this statment

txt_balance.Text = string.Format(dr["balance"].ToString());

推荐答案

这不是string.Format的工作方式.它需要不同类型的参数,每个参数都使用所使用格式的详细信息转换为字符串.
例如:

This is not how string.Format works. It needs arguments of different types, each argument is converted to string using the detail of format used.
For example:

int intValue = 13;
double floatingPointValue = 3.12e-11;
string result = string.Format(
    "This is integer value: {0}; this is floating-point value: {2}",
    intValue, floatingPointValue);



请阅读以下内容:
http://msdn.microsoft.com/en-us/library/system.string. format.aspx [^ ],
http://msdn.microsoft.com/en-us/library/txafckwd.aspx [ ^ ](以及此页面上的所有参考).

—SA



Read about it:
http://msdn.microsoft.com/en-us/library/system.string.format.aspx[^],
http://msdn.microsoft.com/en-us/library/txafckwd.aspx[^] (and all references from this page).

—SA


这篇关于运行应用程序Winform时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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