如何使用MaskedTextBox进行以下操作? [英] How to use MaskedTextBox for following operations?
问题描述
你好...
我想创建一个接受##.####值的蒙版文本框.
但是如何在位置0#.####的蒙版文本框中附加"0"?
例如:如果我输入2.9869,则应显示为02.9869 ...
(我尝试过,但是被遮罩的文本框返回了我的双精度值,所以如果我再次将返回的值设置为被遮罩的文本框,则它会忽略.(点)并将文本值设置为28.86).
请帮助我...我正在使用Visual Basic 2008
您可以发送代码段...
Hello...
I want to create a masked text box that accepts ##.#### value.
But how to append a "0" to that masked text box at position 0#.#### ?
e.g. : if i entered 2.9869 it should to display to 02.9869...
(i tried that but the that masked textbox returns me double value so if i set that returned value to masked textbox again then it neglects the .(dot) and sets the text value to 28.86)
Please help me...i m using Visual Basic 2008
You can send the code snippets...
推荐答案
pre>
您可以使用 ToString
示例代码::
pre>Hi,
You may use ToString
Example code::
Dim acctHashTotal As Decimal = 2.9869
Me.txtAcctHashTotal.Text = acctHashTotal.ToString("0#.0000");
请记住,如果有帮助,请将其标记为答案;如果没有帮助,则将其取消标记..
问候,
代数
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Regards,
Algem
这篇关于如何使用MaskedTextBox进行以下操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!