private void DeviceSetText(TextBox textBox, string text)
{
//处理text的显示值
if (text != "") //小数位后保留2位
{
//小数点后保留2位小数
text = string.Format("{0:0.00}", text);
}
textBox.Invoke((MethodInvoker) delegate
{
textBox.Text = text;
});
}
text = string.Format("{0:0.00}", text);

和下面的问题类似

http://stackoverflow.com/questions/2849688/formatting-is-specified-but-argument-is-not-iformattable

string listOfItemPrices = items.ToSemiColonList(item => string.Format("{0:C}", item.Price.ToString()));

By passing item.Price.ToString() to String.Format, you are passing a string, not a decimal.
Since strings cannot be used with format strings, you're getting an error.

You need to pass the Decimal value to String.Format by removing .ToString().

string.Format里面处理的是数字,但是传递了字符串,所以有这个提示

Formatting is Specified but argument is not IFormattable的更多相关文章

  1. 使用Built-in formatting来创建log字符串

    在一次哦测试中,sonar-qube总是报Use the built-in formatting to contruct this argument, 在网上查了一下,原来它是推荐这样做: log.i ...

  2. Google C++ Style Guide

    Background C++ is one of the main development languages used by many of Google's open-source project ...

  3. Google C++ 代码规范

    Google C++ Style Guide   Table of Contents Header Files Self-contained Headers The #define Guard For ...

  4. python 之 string() 模块

    common string oprationsimport string1. string constants(常量) 1) string.ascii_letters       The concat ...

  5. 02 Go 1.2 Release Notes

    Go 1.2 Release Notes Introduction to Go 1.2 Changes to the language Use of nil Three-index slices Ch ...

  6. lombok插件/slf4j中字符串格式化

    大家在编写springboot项目的过程中可能会接触到lombok这个插件,这个插件可以在编译时帮我生成很多代码. 1.@Data生成Getter和Setter代码,用于类名注释 2.@Getter ...

  7. Supported method argument types Spring MVC

    Supported method argument types The following are the supported method arguments: Request or respons ...

  8. String Formatting in C#

    原文地址 http://blog.stevex.net/string-formatting-in-csharp/ When I started working with the .NET framew ...

  9. CSS学习笔记——视觉格式化模型 visual formatting model

    CSS 视觉格式化模型(visual formatting model)是用来处理文档并将它显示在视觉媒体上的机制.他有一套既定的规则(也就是W3C规范),规定了浏览器该怎么处理每一个盒子.以下内容翻 ...

随机推荐

  1. 安装sinopia-ldap

    背景: 已经安装好sinopia,配置好本地npm源 安装sinopia-ldap: npm install -g sinopia-ldap 配置: 修改sinopia的配置文件config.yaml ...

  2. [译]CSS content

    原文地址:http://css-tricks.com/css-content/ CSS中有一个属性content,只能和伪元素:before和:after一起使用,他们的写法像伪类选择器(前面有冒号) ...

  3. Intellij IDEA配置优化--转载

    1. 在线激活 安装IntelliJ IDEA 2016.1.2版本后,在联网状态下激活.Help --> Register,选择lisence server,粘贴地址http://www.it ...

  4. How to: Extract files from a compiled setup.exe created by Inno setup

    Use innounp.exe to unpack setup.exe created by using Inno setup: for example, unpack all the files w ...

  5. Custom Action : dynamic link library

    工具:VS2010, Installshield 2008 实现功能: 创建一个C++ win32 DLL的工程,MSI 工程需要调用这个DLL,并将Basic MSI工程中的两个参数,传递给DLL, ...

  6. Linux操作系统是如何工作的?破解操作系统的奥秘

    学号:SA12**6112 研究笔记: 1:计算机是怎么样工作的 2:用户态到内核态切换之奥秘解析 3:进程切换之奥秘解析 本博文主要是根据前3篇笔记来总结Linux内核的工作机制. 一:操作系统工作 ...

  7. 解决在管理wordpress时权限不足的问题

    我的wordpress网站的运行环境是自己手动搭建的lamp环境,在管理wordpress时经常遇到因没有足够的权限而无法执行某些操作.在linux上的权限不足的问题无外乎有两个原因,一个是wordp ...

  8. jQuery实例-简单选项卡-【一些常见方法(2)-练习】

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. jquery-easyui使用

    1,闲来无事用了一下jquery-easyui,首先下载下来easyui,文件夹如图 2,将themes里面的东西整体拷贝,我是整体的,省的麻烦了 3,在在自己的vs里面新建一个mvc的项目(项目自己 ...

  10. JS中判断JSON数据是否存在某字段的方法 JavaScript中判断json中是否有某个字段

    方式一 !("key" in obj) 方式二 obj.hasOwnProperty("key")  //obj为json对象. 实例: var jsonwor ...