Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug CS0120. How solve it with 2 classes?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
joantopo
359 Views, 5 Replies

Bug CS0120. How solve it with 2 classes?

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
5 REPLIES 5
Message 2 of 6
Jeff_M
in reply to: joantopo

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.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 6
joantopo
in reply to: Jeff_M

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 4 of 6
Jeff_M
in reply to: joantopo

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.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 6
Jeff_M
in reply to: Jeff_M

I wanted to start that by describing what it is you needed to do. The Control for the palette needs to be public, and created just once. Then update that control when the drawings change.

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 6
joantopo
in reply to: Jeff_M

Perfect!

 

It works!!

Thank you very much Jeff.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report