文字框控件 [英] Textbox Control

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

问题描述

嗨!

我正在使用带有MS Access的VB.NET Windows应用程序2005.

我想在文本框控件中为货币添加2个小数点.
例如.如果在tetbox中输入12,则显示12.00;如果输入12.20,则显示12.20.

我进行了搜索,但不明白他们给出的答案.

请问有人可以通过小例子告诉我该怎么做吗?

谢谢

Hi!

I am using VB.NET windows application 2005 with MS Access.

I want to add 2 decimal point in text box control for currency.
eg. If I enter 12 in tetbox it display 12.00 or if I enter 12.20 then it display 12.20.

I searched for it but I didn''t understand the answer they have given.

Please can anyone can tell me how to do it with small example?

Thanks

推荐答案

TextBox1.Text = Format(Val(TextBox1.Text), "#0.00")


很容易.

将内容定义为双精度.
然后转换为固定2字符串.

例如...

Quite easy.

Define the content as a double.
Then convert to a Fixed 2 string.

example...

Dim dblEntry as Double
dblEntry = TextBox1.Value
TextBox1.Text = dblEntry.ToString("F2")



应该可以解决问题



Should do the trick


这篇关于文字框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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