Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Programatically Add Recent Files Submenu to an Existing Menustrip

$
0
0

I have an existing menustrip with &Files->&Recent Files.  An xml file contains up to 10 file names that I want to add to a Recent Files submenu.  The submenu needs to be dynamically maintained whenever the most recent list changes.  The following code is as far as I have gotten.  How can I add the InnerText to the menu, and how can I remove it when needed?

XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load("recentFiles.xml");
XmlNode rootNode;
rootNode = myXmlDocument.DocumentElement;

foreach (XmlNode xNode in rootNode.ChildNodes)
{
    if (xNode.InnerText != "")
    {
        Console.WriteLine(xNode.InnerText);
    }
}


Experience trumps brilliance -- Thomas Sowell


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>