xsharp.eu • How to remove unwanted Winforms Toolstrip item?
Page 1 of 1

How to remove unwanted Winforms Toolstrip item?

Posted: Wed Mar 29, 2023 12:22 pm
by ic2
In a Winforms form, I have added a context menu where one option has 2 submenu options, added by clicking on the arrow in the designed.
Now, for some reason, it has added this already so the newly generated click method in the properties of the menu item is called: Self:SomeOptionToolStripMenuItem1 , with a 1.

When I remove all code with that '1' in it and go back to the designer to change the name to a name without the '1', the menu option there is empty.

I am able to continue to add a click event pointing to the method without a '1' to the code with the '1' , but I was wondering if anyone knows how to correct such an issue in a Winforms?

Dick

How to remove unwanted Winforms Toolstrip item?

Posted: Wed Mar 29, 2023 1:37 pm
by Chris
Hi Dick,

Please select the menu item in the designer, then go to the Properties tool window, go to the Events page (it's the button with the lightning icon), then locate the entry for "Click" and change it to the correct name.

How to remove unwanted Winforms Toolstrip item?

Posted: Wed Mar 29, 2023 8:21 pm
by ic2
Hello Chris,

It's not the click even which is the problem (this I already redirected to the one without the '1') but the name. There is actually a SomeOptionToolStripMenuItem (without the '1' so it makes sense I can't assign that name again ). It says it's a ToolStripMenuItem but not one I can find in the menu and it also doesn't open the menu in the Designer when I select it (contrary to the other ToolStripMenuItem names) hence the problem is:

1 when I select that from the drop down I don't see anything selected in the (Design). So I can't delete it from the window.
2 And as far as I can see, I can not delete it directly from the Properties either.

Dick

How to remove unwanted Winforms Toolstrip item?

Posted: Wed Mar 29, 2023 8:37 pm
by Chris
Hi Dick,

OK, then please open the designer.prg file of the form and delete ALL lines (but nothing else) that contain the text

Code: Select all

SomeOptionToolStripMenuItem1
. But keep a backup of all your code first, just in case something goes wrong.