Custom Component Issue
-
I have built a custom component that I use rather extensively but it has a "feature" that is not correct but I haven't been able to determine why. I converted one my Delphi components and merged it with features from several contributors here. I would like to thank all of you. The basis of the component is as follows:
using System; using System.Collections; using System.Windows.Forms; using System.ComponentModel; using System.Text.RegularExpressions; namespace MyComponents { public class myMaskedEdit : TextBox { public enum InputMaskType { None, Dollars, Number, Integer, Percent, Phone, SSN, Zip, Custom } public myMaskedEdit() { ... } ... Other Methods ... } }
I drag the component onto my UserControl and it looks something like:using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace PARTS { public class ucRMAHeader : System.Windows.Forms.UserControl { public ucRMAHeader() { InitializeComponent(); SetupForm(); } ... Other Methods ... #region Component Designer generated code private void InitializeComponent() { ... this.myMaskedEdit1.ErrorInvalid = false; this.myMaskedEdit1.FormatText = true; this.myMaskedEdit1.Location = new System.Drawing.Point(8, 48); this.myMaskedEdit1.MaxLength = 0; this.myMaskedEdit1.Name = "myMaskedEdit1"; this.myMaskedEdit1.Size = new System.Drawing.Size(108, 20); this.myMaskedEdit1.StdInputMask = MyComponents.myMaskedEdit.InputMaskType.Integer; this.myMaskedEdit1.TabIndex = 214; ... } #endregion } }
I can set all the properties correctly and the program will compile and run as intended. The above code is how it is seen in the program. I then close the window for maintaining the form. I reopen it and the StdInpu -
I have built a custom component that I use rather extensively but it has a "feature" that is not correct but I haven't been able to determine why. I converted one my Delphi components and merged it with features from several contributors here. I would like to thank all of you. The basis of the component is as follows:
using System; using System.Collections; using System.Windows.Forms; using System.ComponentModel; using System.Text.RegularExpressions; namespace MyComponents { public class myMaskedEdit : TextBox { public enum InputMaskType { None, Dollars, Number, Integer, Percent, Phone, SSN, Zip, Custom } public myMaskedEdit() { ... } ... Other Methods ... } }
I drag the component onto my UserControl and it looks something like:using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace PARTS { public class ucRMAHeader : System.Windows.Forms.UserControl { public ucRMAHeader() { InitializeComponent(); SetupForm(); } ... Other Methods ... #region Component Designer generated code private void InitializeComponent() { ... this.myMaskedEdit1.ErrorInvalid = false; this.myMaskedEdit1.FormatText = true; this.myMaskedEdit1.Location = new System.Drawing.Point(8, 48); this.myMaskedEdit1.MaxLength = 0; this.myMaskedEdit1.Name = "myMaskedEdit1"; this.myMaskedEdit1.Size = new System.Drawing.Size(108, 20); this.myMaskedEdit1.StdInputMask = MyComponents.myMaskedEdit.InputMaskType.Integer; this.myMaskedEdit1.TabIndex = 214; ... } #endregion } }
I can set all the properties correctly and the program will compile and run as intended. The above code is how it is seen in the program. I then close the window for maintaining the form. I reopen it and the StdInpuI'm not sure why this question bothered someone to where they jest with their own version of it. I guess the bottom line is that my understanding of the properties is that they are stored in the Component Designer section of the code. If I open the window again to maintain it, the Component Designer code should've repopulated the property editor...but it doesn't. Whether it is my component or not, I wouldn't think it would matter. I don't believe my question is that far out of line.