Screenshot:

I filled the above menu in the screenshot using the code below, but it’s stupid for me, I can’t understand how I can create a click event on each subitem, since they don’t have a property name ?: S My intention is to click, say, “Do and do, "then the file is opened using Process.Start(filename); . Please carry me as I am very new to programming .: | Thank you very much!
private void loadViewTemplates(string path) { foreach (string file in Directory.GetFiles(path, "*.txt")) { ToolStripItem subItem = new ToolStripMenuItem(); subItem.Text = Path.GetFileNameWithoutExtension(file); viewTemplatesToolStripMenuItem.DropDownItems.Add(subItem); } }
source share