How to remove unwanted Winforms Toolstrip item?

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

How to remove unwanted Winforms Toolstrip item?

Post 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
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

How to remove unwanted Winforms Toolstrip item?

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

How to remove unwanted Winforms Toolstrip item?

Post 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
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

How to remove unwanted Winforms Toolstrip item?

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply