在打字时,数据网格视图中的3位数分离 [英] 3 digit seperating in dat grid view WHEN TYPING

查看:63
本文介绍了在打字时,数据网格视图中的3位数分离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI bax我无法解决我的问题但请帮助我,我想要当我在一列网格中输入数字时自动分隔,

进行考试时我输入12365432其IMMEDIATe转换为123,654,32

谢谢

解决方案

根据我的理解,您希望在每次用户交互时更新(例如,当用户正在编辑某个号码时)在TextBox中)。



如果是这种情况,它应该非常简单,只需连接到正确的事件(可能是 TextChanged 或类似的东西,MSDN是查找更多详细信息的地方)并根据Text属性进行更改。



确保检查准备设置为Text属性的新值的字符串与Text属性中的字符串之间是否存在任何差异Text属性如果不同则避免无限循环。新格式化字符串的编写应该很容易,你应该从字符串中删除千位和小数分隔符,解析它并将解析后的值转换为字符串。或类似的东西。



希望我对你有任何帮助。



快乐的编码。 :)

HI bax i cant solve my problem yet please help me i want when im typing in one column of grid the number separating automatic by ","
for exam when im typing 12365432 its IMMEDIATe convert to 123,654,32
thanks

解决方案

From what I understood, you wish to update on every user interaction (e.g. when user is editing some number in TextBox).

If that is the case, it should be very easy, just hook up to proper event (probably TextChanged or something like that, MSDN is the place to find out more detailed information) and make your changes accordingly to the Text property.

Make sure that you check if there is any difference between string that you prepared to set as new value of Text property and the string that is in Text property and only change Text property if they are different to avoid infinite loop. The preparation of newly formatted string should be easy, you should remove thousand and decimal separator from string, pars it and parsed value convert to string. Or something like that.

Hope I was of any help to you.

Happy coding. :)


这篇关于在打字时,数据网格视图中的3位数分离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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