VB2005 - Databound MaskedTextBox controls lose mask in MdiChild Forms.

M

Matt

I recently came across what I believe to be a peculiar bug with Mdi
Children, and wanted to see if anyone else had experienced this before
sending it in. The issue is as follows:

I have a number of forms set up as children of a single "Shell"
MdiParent. In these, I have a number of databound masked textbox
controls (for phone numbers, 9-digit zips, etc...). When I show the form
the first time, the masks show up fine; however, if I hide the form (not
close, just hide), then show it once more, the masks completely
disappear. The proper text is still displayed, simply sans mask. If you
attempt to edit the field, the mask will return, albeit in a peculiar
manner (hard to describe, seems to treat some of the data as literals
for the mask or something like that.)

If I close the form entirely and re-open it, I do not see this issue,
nor is it a problem if the form is not an MdiChild. Similarly, the
problem seems to be non-existent for unbound masked textboxes.

To be explicit, steps for recreation:
1. Create a new form; name this "ParentShell" or something of the sort,
and set its IsMdiContainer property to True.

2. Create a second new form; name this "ChildForm".

3. Add, to the ChildForm, a MaskedTextBox control bound to a phone
number field (just for example, anything works) in a database with some
data already entered. Set the control's mask to the default phone number
mask (or zip, or whatever you used).

4. In the ParentShell's Load event, set the ChildForm's parent to the
ParentShell, then show it, hide it, and show it once more:
ChildForm.MdiParent = Me
ChildForm.Show()
ChildForm.Hide()
ChildForm.Show()

(If you prefer, you may simply create a menu or a button on the parent
form that allows you to show and hide the child form at will; the issue
can be recreated without having the code all in one place.)

5.You should see the phone number (in the example) displayed as digits
without any remaining trace of the mask.

Any ideas/solutions?

Thanks,
Matt
 
P

Peter Huang [MSFT]

Hi Matt,

Based on my test, it seems that I can not reproduce the problem.
I bound to a SQL Server Northwind Customer Table of the Phone Field.

Can you provide a reproduce sample, so that we can reproduce at my side and
do further troubleshooting?
You can reach me via removing "online" from my Email address.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top