Here is a class I wrote to manage the MRU in a VB.Net application am writing. I did not find a build-in class in Visual Studio or on-line that did not look like a pain to use, so I made my own. While I have some 30 years of programming experience, I am pretty new to the .Net languages, so it is quite likely that I missed something that was already available in the .Net libraries, as this is a fairly common functionality, especially with the kinds of applications I write.
Instructions for use are in the REM statements at the beginning of the class. In addition to an instance of the class, you will need to define a Collections.Specialized.StringCollection to store the actual information. This can then be stored in My.Settings or serialized into a file to be stored.
You also need to define a menu item (passed to New), typically under File, to be the anchor for the list. All the menu items will be on a child menu of this menu item.
The class has a sub-class that it uses for throwing exceptions: MRUException. It keeps track of multiple types of errors that each define a different Message for each type of error. Most of these indicate that the functions were called with invalid arguments (like passing Nothing for the StringCollection, etc.).
Any suggestions for improvements will be welcome. If there are any questions, please comment here and I will try to answer them. I hope others on DaniWeb find this class helpful.
Edited 4 Years Ago by Nutster: Explain about MRUException and menu. Found and fixed some bugs.