0
  1. I want to use C# develop autocad and I build a new windows form project and add a button on it, I will put the parameter in the form.
  2. The question is: I want to write code below the click button to call the method in another class

    private void guocheng1_Click(object sender, EventArgs e) { MyCommands myMyCommands = new MyCommands(); MyCommands.Myds = new Myds() ; } public void Myds() // This method can have any name { // Put your command code here Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; ed.WriteMessage("\r\nThis is an Initialization Startup text."); } 

I don't know what's wrong.

1
  • It looks like you should just be using myMyCommands.Myds();. You're not trying to construct anything at that point, right? Commented Nov 28, 2016 at 10:31

1 Answer 1

1
 private void guocheng1_Click(object sender, EventArgs e) { MyCommands myMyCommands = new MyCommands(); myMyCommands.Myds() ; //this, its not a static method. Also, this is how you call a method. } public void Myds() // This method can have any name { // Put your command code here Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; ed.WriteMessage("\r\nThis is an Initialization Startup text."); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.