Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Prevent space in maskedEditBox

Posted on 2016-07-21
4
Medium Priority
?
65 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
Russ Suter earned 2000 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 70

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 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