Solved

Strrange behavior using masked edit

Posted on 2016-07-21
7
14 Views
Last Modified: 2016-07-22
I have simple Windows form (not WEB app), a test app for this problem.  It has a masked Edit and a button.  mask is "00000000" (8 zeroes) and prompt char is a space, because I don't want a prompt char.  In button click event, I set the focus to the text box because in my real app depending on what the user enters, I do not close my dialog and instead force them to reenter data.   I can click the button all day and all is fine - textbox get focus.  However, if I use the mouse to click in the text box, I get 8 space (size of the mask) inserted into the text box.   Why? I don't get it??  See image.  I can tell this happens by seeing  the blinking cursor.  


spaces in textbox.
0
Comment
Question by:HLRosenberger
  • 4
  • 2
7 Comments
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41723477
oh, I get this behavior even without the button click.  Just clicking into the textbox, and I get the 8 spaces.
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41723492
If I do this in the click event for the textbox, the cursor to the beginning of the text box, and now I can type into it.  Otherwise, with those spaces, I can't type.  

  MaskedTextBox1.Text = ""
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 41723502
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 41723552
>>mask is "00000000" (8 zeroes) and prompt char is a space

Why are you surprised that it works as you instructed it to work ??
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41723686
Not surprised, really I guess.  I guess there's not way to truly have no prompt character.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 41723756
>> I guess there's not way to truly have no prompt character.
Correct (for a masked edit control), for none then you have to code your own, which isn't that difficult for just an integer number.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41724969
yup, I'll do it myself in code. thanks.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

13 Experts available now in Live!

Get 1:1 Help Now