views:

227

answers:

2

How can I store the items in a context menu strip in the Settings so they are in the context menu when the application is next started?

Or is there a better way than using settings? (they are recently opened files in the cms)

A: 

There may be a settings persistence mechanism specifically for this, but if not you need to somehow save the data which will allow reconstruction of the menu strip.

Figure out some metadata that can be saved to a file (XML comes to mind) and then use that to re-build the items upon startup.

Alternately, you may be able to simply persist the serialized menu strip objects to disk.

Peter Loron
User settings (My.Settings) is essentially an XML settings file so it can be used to save said metadata easily ;-)
Meta-Knight
A: 

It's a good idea to save them as user settings. I would save them as a StringCollection (each item of the collection would be a recently opened file path). When your application loads you just have to go through this collection and add corresponding context menu items.

Meta-Knight