Solved

Strrange behavior using masked edit

Posted on 2016-07-21
7
18 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
[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
  • 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 70

Expert Comment

by:Éric Moreau
ID: 41723502
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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