Solved

Prevent space in maskedEditBox

Posted on 2016-07-21
4
63 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 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

617 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