是否可以使用MaskedTextBox来获取特定格式?

编程入门 行业动态 更新时间:2024-10-26 07:29:35
本文介绍了是否可以使用MaskedTextBox来获取特定格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要一个文本框控件,可以接受以下格式输入:2 w 3 d 5 h 6 m。用户应该能够在d,w,h和m之前编辑值(表示周,日,小时,分钟)。是否可以使用MaskedTextBox来实现相同的目标。 w,d,h和m不应该是可编辑的。 谢谢, Divya

Hi, I require a textbox control that would accept input in the form : 2 w 3 d 5 h 6 m. User should be able to edit the values before d, w, h and m ( which represents weeks, days, hours, minutes). Is it possible to use MaskedTextBox to achieve the same. w,d,h and m should not be editable. Thanks, Divya

推荐答案

您可以通过实现 MaskedTextProvider 来实现此目的。 查看如何实现它的示例此处。 You can accomplish this by implementing a MaskedTextProvider. See an example of how to implement it here.

您可以使用CSS类来实现它。创建一个CSS类并在document.ready中使用query创建一个函数(。cssclassname)。functio {编写正则表达式以验证在任何已添加此类的输入文本框中给出的输入}。 由于查询可以使用Id或CSS类名访问任何控件。如果需要更多说明,请告诉我 谢谢和问候 Murtuza You can implement it by using CSS class. Create a CSS class and in document.ready create a function using query(".cssclassname").functio{ write the regular expression to validate the input given in any input text box which ever has added this class}. As query can access any control using either Id or a CSS class name. Please let me know if need more clarification Thanks and regards Murtuza

更多推荐

是否可以使用MaskedTextBox来获取特定格式?

本文发布于:2023-05-27 09:56:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/285749.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   格式   MaskedTextBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!