E
electroVik
I have a custom control called, lets say, SportBillyComboBox, which
inherits from ComboBox. When I add my control from the toolbox, I get
an error (System.NullReferenceException : Object not set to an
instance of an object) on my form replacing the control, but my newly
added SportBillyComboBox is there (even if "you can't see it" - under
the Exception) and seems to work fine in compilation and in runtime.
But when I next use the Windows Forms Designer to change or add
something, it automatically adds those lines in the designer :
this.SportBillyComboBox1.Items.AddRange(new object[] {
((object)(resources.GetObject("SportBillyComboBox1.Items"))),
((object)(resources.GetObject("SportBillyComboBox1.Items1"))),
((object)(resources.GetObject("SportBillyComboBox1.Items2"))),
((object)(resources.GetObject("SportBillyComboBox1.Items3")))});
Even if I never asked in the Designer to add some items in the
collection, it magically appears in my InitializeComponent Code -
TADAM! But worse of all, it doesn't add the necessary entries into my
Form1.resx resources file so the code crashes on the newly
automatically magically added line. Sure, I can always erase those
lines, but every time I change something in my form, it add those
lines again and again and again...
Anyone having a fix for this one? Even my first problem (when I add
the control to my form... the little "System.NullReferenceException"
error) is disturbing!
Do you have any clue?
Thank you,
electroVik
inherits from ComboBox. When I add my control from the toolbox, I get
an error (System.NullReferenceException : Object not set to an
instance of an object) on my form replacing the control, but my newly
added SportBillyComboBox is there (even if "you can't see it" - under
the Exception) and seems to work fine in compilation and in runtime.
But when I next use the Windows Forms Designer to change or add
something, it automatically adds those lines in the designer :
this.SportBillyComboBox1.Items.AddRange(new object[] {
((object)(resources.GetObject("SportBillyComboBox1.Items"))),
((object)(resources.GetObject("SportBillyComboBox1.Items1"))),
((object)(resources.GetObject("SportBillyComboBox1.Items2"))),
((object)(resources.GetObject("SportBillyComboBox1.Items3")))});
Even if I never asked in the Designer to add some items in the
collection, it magically appears in my InitializeComponent Code -
TADAM! But worse of all, it doesn't add the necessary entries into my
Form1.resx resources file so the code crashes on the newly
automatically magically added line. Sure, I can always erase those
lines, but every time I change something in my form, it add those
lines again and again and again...
Anyone having a fix for this one? Even my first problem (when I add
the control to my form... the little "System.NullReferenceException"
error) is disturbing!
Do you have any clue?
Thank you,
electroVik