dotnet / dotnet/dotnet-api-docs

Winform Masked Textbox causes ModifiedChanged event to not fire

Open
#8,878 0 comments 0 reactions 0 assignees View on GitHub
area-WinForms Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

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. I have confirmed the TextChanged event does 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);

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.