如何在C#中将字符串从文本框转换为十进制值? [英] How do I convert a string from textbox to a decimal value in C#?
本文介绍了如何在C#中将字符串从文本框转换为十进制值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用文本框中的转换值,然后将其转换为十进制值,以便可用于计算。
I want to use a conversion value from a textbox and then convert it into a decimal value so it is usable for calculations.
推荐答案
您没有转换 ,你解析字符串。使用其中一个字符串方法Parse
或TryParse
。了解它们:
http://msdn.microsoft.com/ en-us / library / system.string.aspx [ ^ ]。
-SA
You do not "convert", you parse the string. Use one of the string methodsParse
orTryParse
. Read about them:
http://msdn.microsoft.com/en-us/library/system.string.aspx[^].
—SA
这篇关于如何在C#中将字符串从文本框转换为十进制值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文