471,627 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Preventing wincode on custom control?

I have a custom control that defines

this.AlternatingBackColor = System.Drawing.Color.Lavender;

in its constructor. When I add this control from my VS.NET 2003
toolbar and drop it onto a form, the same line of code is generated in
the form's InitializeComponent():

this.customGrid.AlternatingBackColor = System.Drawing.Color.Lavender;

which generates a run time error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll

Additional information: The data grid table styles collection already
contains a table style with the same mapping name.
How do I prevent the wincode from being generated for the custom
control?

Thanks,
Brett

Jan 27 '06 #1
2 1198
Actually, this was coming from the datagridstyle. Not sure how it got
there but I define one in the control. Removing these lines fixed it:

this.dataGridTableStyle2.DataGrid = this.dgRelative;
this.dataGridTableStyle2.HeaderForeColor =
System.Drawing.SystemColors.ControlText;
this.dataGridTableStyle2.MappingName = "default";

Brett

Jan 27 '06 #2
Actually, the IDE, compiler, or some stubborn piece of code somewhere
keeps adding these back as style3, style4, style5, etc. I need some
way to just slap its hand and say stop doing that. Any ideas?

Thanks,
Brett

Jan 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by One Handed Man \( OHM - Terry Burns \) | last post: by
1 post views Thread by Wannabe_Geek | last post: by
1 post views Thread by Brett Romero | last post: by
3 posts views Thread by Fredo | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.