开发者

Mask in C#: get a number that can be up to 10 digits in length that will accept leading 0's

开发者 https://www.devze.com 2023-02-01 18:37 出处:网络
I guess this would be a DevExpress mask, but here is what I have: var dlEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();

I guess this would be a DevExpress mask, but here is what I have:

var dlEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
dlEdit.Mask.MaskType = MaskType.RegEx;
dlEdit.Mask.EditMask = "\\d{1,10}";

I'm trying to get a number that can be up to 10 digits in length that WILL accept leading 0's, as it is now it will show the leading 0's (ex. 0032421243) until the field is clicked off in which case it removes them. I tried a numeric masktype but same thing only it wouldn't let me enter the 0's to start with at all. I thought this would be my answer but this custom typ开发者_开发问答e isn't. Can someone point me in the right direction for what I need? Maybe a different type of mask or something?


Your mask works fine for me.

Are you binding to a numeric field?
If so, you can't do this; numeric fields cannot store leading zeroes.
Switch to a string field.

0

精彩评论

暂无评论...
验证码 换一张
取 消