Winform Masked Textbox causes ModifiedChanged event to not fire

Pat Hanks 141 Reputation points

I have been struggling with this one issue and just can't seen to find an answer. If I set a mask value the ZipcodeTextbox MaskedTextbox control it will result in the event not firing. In the code below I can comment out the mask setting and the event will fire. I have even tried to set the mask on the ZipcodeTextbox the same as the SupportPhoneTextbox and still the event will not fire.

Any suggestions or pointing me towards an answer is greatly appreciated.

// SupportPhoneTextbox
this.SupportPhoneTextbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.SupportPhoneTextbox.Location = new System.Drawing.Point(410, 46);
this.SupportPhoneTextbox.Mask = "(999) 000-0000";
this.SupportPhoneTextbox.Name = "SupportPhoneTextbox";
this.SupportPhoneTextbox.Size = new System.Drawing.Size(114, 23);
this.SupportPhoneTextbox.TabIndex = 31;
this.SupportPhoneTextbox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
this.SupportPhoneTextbox.TextChanged += new EventHandler(SupportPhoneTextbox_ModifiedChanged);
// ZipcodeTextbox
this.ZipcodeTextbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ZipcodeTextbox.Location = new System.Drawing.Point(74, 126);
this.ZipcodeTextbox.Name = "ZipcodeTextbox";
this.ZipcodeTextbox.Mask = "00000-9999";
this.ZipcodeTextbox.Size = new System.Drawing.Size(83, 23);
this.ZipcodeTextbox.TabIndex = 34;
this.ZipcodeTextbox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
this.ZipcodeTextbox.ModifiedChanged += new EventHandler(ZipcodeTextbox_ModifiedChanged);

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,818 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,185 questions
{count} votes