Solved

Prevent space in maskedEditBox

Posted on 2016-07-21
4
30 Views
Last Modified: 2016-07-21
How do I prevent a space from being entered in a masked edit box?   This is VB.NET
0
Comment
Question by:HLRosenberger
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
Russ Suter earned 500 total points
ID: 41723333
Is this a Windows Forms project or a Web Application project?

The former solution involves an event handler. The latter would need Javascript. In either case there is a solution.

Since you mentioned VB.NET I'm going to assume it's a web application. In that case, here's a jQuery snippet that will do the trick for you:
$("#[YourControlId]").on({
  keydown: function(e) {
    if (e.which === 32)
      return false;
  },
  change: function() {
    this.value = this.value.replace(/\s/g, "");
  }
});

Open in new window

0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 41723354
what is your mask?
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41723389
Sorry.  it is not WEB app.  and I got it working using your concept - in keypress, if it's a space, I set it to NULL. Thanks!
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41723391
Thanks!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now