Question Copy Chart

solfinker

Well-known member
Joined
Aug 6, 2013
Messages
71
Programming Experience
Beginner
I can copy labels, textboxes, buttons, pictureboxes, etc. from form to form, but I cannot copy a chart thus I must re-write chartareas, series, legends...
Is there a short-cut for this?

Thanks a lot for your help.
 
I have no problem copying a chart from one form to another within one project, all designer generated code is duplicated. From one project to another is another matter, for which I can confirm copy is not possible in a "fresh" prosject. The problem is that the project must reference the required libraries for IDE to be able to complete the paste operation and generate the new code for that control.
For Chart control a requirement is the System.Windows.Forms.DataVisualization.dll library. You can add this with Add Reference dialog, but simplest way to add it to a new project is to just add a new Chart control to a form, then delete it, the required references is then added and remains, and paste is now possible.
 
Back
Top