Hi All,
I'm sure the answer to this is going to be obvious but I've googled it to no avail!!
I want to dynamically build a menu. When doing so, I want to check if an item already exists but struugling!
Simplified Example:
Obiously, when I am adding to DropDownItems, I have specified no key, but I cannot see any way to do so!
Any help appreciated,
Graeme
"Just beacuse you're paranoid, don't mean they're not after you
I'm sure the answer to this is going to be obvious but I've googled it to no avail!!
I want to dynamically build a menu. When doing so, I want to check if an item already exists but struugling!
Simplified Example:
Code:
// this adds an item called 'item1' to the 'Tools' menu
toolsToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem("Item1"));
if (toolsToolStripMenuItem.DropDownItems.ContainsKey("Item1"))
{
MessageBox.Show("WORKED");
}
else
{
MessageBox.Show("NOT WORKED");
}
Obiously, when I am adding to DropDownItems, I have specified no key, but I cannot see any way to do so!
Any help appreciated,
Graeme
"Just beacuse you're paranoid, don't mean they're not after you