Reputation: 1
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.
Upvotes: 0
Views: 269
Reputation: 4000
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.");
}
Upvotes: 1