I have this error:
http://msdn.microsoft.com/es-es/library/s35hcfh7(v=vs.80).aspx
the document says that there are two solutions:
-Both methods as "STATIC".
-Create a new instance of the class(object).
But two methods are in the same class.
I aproach my project with a zip file, I have indicated two interruption points.
http://www.mediafire.com/?699oitknl61xczt
COMMAND: visor
I want to use. the event "documentActivated". This event is in the class "toolsC3Daplicacion" and it calls the method "callback_documentActivated" that is in the same class.
This method call the method called "proces" (second interruption point) but is in other class "TypeViewerControl".
I can´t create a new instance about a object TypeViewerControl because is already opened and when I open or change of active drawing, I want to load datagrid´s alignments.
The code in the method "proces" do this, but I can´t create a new instance of object. This object is a paletteSet and I always opened it.
I need help, please.
Thank you.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
I'm not getting any error in VS 2010. Although I see that the control does not update when switching drawings. No time for me to play right now, if you don't have it figured out by tonight (my time, in California) I will see what I can come up with.
Exactly.
No error occurs but does not load the datagrid when the event occurs.
I have no hurry.
I would like to know how to fix this.
In the TypeViewerPalette, make the tvc a public object:
// We need to make the textbox available
// via a static member
public static TypeViewerControl tvc = null;
In your callback funtion for the document activated event, make sure it doesn't do anything if tvc is null:
public void callback_documentActivated(object sender, DocumentCollectionEventArgs e)
{
if (TypeViewerPalette.tvc != null)
{
TypeViewer.TypeViewerControl.proces();
}
}
and finally, in the TypeViewerControl, edit the proces function to use this:
TypeViewerPalette.tvc.dataGridView_Alineaciones.AutoGenerateColumns = false; // hay que dejarlo porque generaremos luego columnas por diseño.
TypeViewerPalette.tvc.dataGridView_Alineaciones.DataSource = toolsC3D.variables_globales.aligns;//usamos DataSource cargar el list en el datagrid
TypeViewerPalette.tvc.dataGridView_Alineaciones.Update();//this may not be needed
With these changes I can now switch drawings and have the form update the alignments.
Perfect!
It works!!
Thank you very much Jeff.