分隔文本框中数字的功能 [英] Function to separate the figures in the textbox

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

问题描述

我想在文本框中分隔数字
在textchange中
3个数字中的3个数字可在文本框中分开显示
像12000表演12,000
但这是文字变化的变化

在撰写本文时

I want to separate the numbers in the textbox
in the textchange
3 of 3 digits to separate for money in the textbox
like 12000 show 12,000
but this change in the textchange

At the time of writing

推荐答案

这并不难-只需处理KeyPress事件并做到这一点-但这根本不是一个好主意.
问题是您使用的PC上的本地文化可能未设置为使用逗号作为千位分隔符:可能未设置为冒号,也未使用印度风格编号(第一组为三位数,但随后的组是两个),或者使用点号和逗号反转,或者使用引号,或者...这里有一个列表可能会有所帮助:
That isn''t difficult to do - just handle the KeyPress event and do it - but it isn''t a good idea at all.
The problem is that the local culture on the PC you are using =may not be set to use a comma as a thousands separator: it may be set for no spearator, or to use Indian style numbers (where the first group is three digits, but subsequent groups are two), or to use dot and comma reversed, or a quote, or... there is a list here which might help: International Number Formats[^]

Really, I wouldn''t do it, myself. You run too much risk of confusing your user rather than helping him. If you must display thousands in local format, use a NumericUpDown instead, and set the ThousandsSeparator property to true. It won''t change the display while he is typing (which can confuse all on it''s own), but it will when he leaves.


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

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