获得百分比价值 [英] Getting Percentage Value

查看:83
本文介绍了获得百分比价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道如何从您输入的百分比数字中获取值?例如我在vb6,vb.net上有一个文本框,我想得到它的百分比值并显示在msgbox上,例如,如果我在50%的文本框中输入一个百分比数字,那么输出应该是0.50。我有问题如何得到它...对不起我的坏英语家伙.. tnx提前。

does anybody know how to get a value from a percentage number that you have entered? for example i have a textbox on vb6,vb.net and i want to get its percent value and display it on a msgbox, for example if i enter a percentage number on the textbox of "50%" then the output should be 0.50. im having problems on how to get it.. sorry for my bad english guys.. tnx in advance.

推荐答案

这很简单。



Catch TextBox.Text 值为字符串变量,然后删除和除以 100 ;)



请参阅:

更换 [ ^ ]

Decimal.TryParse [ ^ ]
It's quite simple.

Catch TextBox.Text value to string variable, then remove "%" and divide by 100 ;)

Please see:
Replace[^]
Decimal.TryParse[^]


这篇关于获得百分比价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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