Jump to content
Software FX Community

chart embedded in user control can cause exception in form designer

John Mattingly

Recommended Posts

I've observed that if I alter the design of a chart in a user control, the form designer will sometimes throw an exception when I try to edit any form containing that user control.

In particluar, I've noticed that if I alter either the Background or Border property of the chart, such that the component designer sets one of these properties in InitializeComponent, the form designer throws an exception complaining that the set_Background (or set_Border) method was not found.

Furthermore, the problem occurs whenever my user control's constructor, or any method called by it (like InitializeComponent), attempts to either get or set the Background or Border properties.

I only encounter this problem when the chart is embedded in a user control.  It does not occur if the chart is embedded in a form.  Finally, the problem doesn't occur at run-time; it only occurs at design-time.

Please note that it shouldn't be a license issue.  The user control is a component of the executable, which has the license embedded.

I've attached an example of offending code.  The problem can only be resolved by (1) removing the component designer code that sets the Background property, or (2) exiting Visual Studio with both the user control and the containing form open for editing and then restarting Visual Studio.

Does anyone have a suggested fix?

Link to comment
Share on other sites

I'm sorry, Frank.  After I uploaded the example, I found that the problem could be resolved by closing and restarting Visual Studio.  If you still want to try to reproduce it, here are the steps:

(1) Create a new windows application project.

(2) Add a new user control to the project; put a chart on the user control.

(3) Add the user control to the main form.

(4) Change the border or background of the chart in the user control, e.g., set the border type to 'Embed'.

(5) Go back to the design view of the main form.  You should see an error like the attachment.

Now that I know I can exit and restart Visual Studio, I guess I can live with that.  It may be a problem on their end, anyway.



Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...