Trouble Overriding Custom UI in GH_Component methods

Hi all,

I’m trying to custom grasshopper by override certain methods in GH_Component. However, there are two errors. Not sure if I’m missing something obvious here.

public class MyClass : GH_Component
  protected override void AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown menu)
    Menu_AppendItem(menu, "My Custom Menu Item");

I have two error at the bold words.

1: Override. It says There is no suitable methods for override (There is obviously is!?)
2. Menu: Argument type is not assignable to parameter type (how can it be not suitable when they are exactly the same type. I already included System.WindowsForms)

Some people on SpaceSyntax encountered similar problem before but they were answered to check the base class, in this case is GH_Component.

Thank you very much!

I’m not sure what’s wrong. You can at least get rid of the second error since you don’t have to call the base class. The default AppendAdditionalComponentMenuItems() method does nothing.

However it’s likely that both errors have the same cause. Which .NET framework are you referencing in your project?

I honestly could not comprehend what happened. I saved and opened my file the next day and all the reported errors disappeared. Not sure if a miracle just happened. But I think one possible explanation could be due to overload methods and the computer could only match the type and method the second time.