Hi i have a simple question. here is my code:
XmlDocument xmlData = new XmlDocument();
xmlData.Load(\"xml.xml\");
/* Load announceme
You could use the Tag property of the ToolStripMenuItem:
item.Tag = Announcements[i].LastChild.InnerText;
public void item_click(object sender, EventArgs e)
{
var menu = sender as ToolStripMenuItem;
if (menu!= null)
MessageBox.Show(menu.Tag);
}
Or you could use a lambda, which will capture the variable:
string data = Announcements[i].LastChild.InnerText;
item.Click += (s, e) => { MessageBox.Show(data); };