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. Ext.Net学习笔记18:Ext.Net 可编辑的GridPanel

    Ext.Net学习笔记18:Ext.Net 可编辑的GridPanel Ext.Net GridPanel 有两种编辑模式:编辑单元格和编辑行. 单元格编辑: 行编辑: 可以看出,单元格编辑的时候,只 ...

  2. 03_线程的创建和启动_实现Runnable接口方式

    [线程的创建和启动的步骤(实现Runnable接口方式)] 1.定义Runnable接口的实现类,并重写其中的run方法.run()方法的方法体是线程执行体. class SonThread  imp ...

  3. (LightOJ 1149) Factors and Multiples

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1149 Description You will be given two sets o ...

  4. 清橙OJ 1082 查找第K小元素 -- 快速排序

    题目地址:http://oj.tsinsen.com/A1082 问题描述 给定一个大小为n的数组s和一个整数K,请找出数组中的第K小元素. 这是一个补充程序的试题,你需要完成一个函数: int fi ...

  5. elementary os进入GUI桌面环境失败

    问题描述:电脑上安装了elementary os,重启后系统很顺利的到达了Login图形界面,在选定用户并键入正确的密码后,电脑黑屏了一至两秒钟后又回到的Login界面,一开始以为是密码输入错误了,就 ...

  6. leetcode problem 33 -- Search in Rotated Sorted Array

    Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...

  7. NpoiUtil

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  8. 根据版本的不同整理所有的绿色SQL Server

    在这篇论坛文章中,读者可以了解到如何根据不同的SQL Server版本,整理出所有版本的绿色SQL Server的具体方法,详细内容请参考下文: 1. Sqlservr.exe 运行参数 Sql Se ...

  9. 【PyInstaller安装及使用】将py程序转换成exe可执行程序

    1  配置所需的环境 平台:windows7 64位,已经安装了python(x,y) 若未安装python环境,请自行安装python2.7或者其他版本,Python安装完成以后,需要将Python ...

  10. json在线校验

    弄了一个在线校验,清爽无广告,欢迎大家收藏   http://www.zhhoney.com/