eramgarden Posted January 18, 2005 Posted January 18, 2005 I have a dropdown box on a form where I can type in values into the box... So far so good.. My manager wants functionality that the combobox remembers what the user entered ..so nexttime when they use the app, it shows what they had entered previously... We dont want to save the entries in database... This is something like ASP.Net and using cookies.. He said there's a class that does that but i cant find any examples.. anyone? Quote
donnacha Posted January 18, 2005 Posted January 18, 2005 You can do what you like with an xml file so look for examples of reading/writing to xml files. Quote Hamlet
eramgarden Posted January 18, 2005 Author Posted January 18, 2005 I'll look into that but I dont think this is what he's looking for... He said there's a class for it that remembers the selection.. yes, no? Quote
donnacha Posted January 18, 2005 Posted January 18, 2005 The class you want is System.Net.Cookie but again this is for ASP as the help says "The Cookie class is used by a client application to retrieve information about cookies received with HTTP responses. The following cookie formats are supported during parsing the HTTP resonse headers: Netscape, RFC 2109, and RFC 2965." Stop trying to do ASP stuff in windows apps, windows allows you to do things easier than asp.. Quote Hamlet
eramgarden Posted January 18, 2005 Author Posted January 18, 2005 one more question: My manager also wants the "most recently" values under "File" menu..just like , for example, Excel..where under "File"..it remembers the docs recently opened by the user... is that also done thru XML? Quote
penfold69 Posted January 18, 2005 Posted January 18, 2005 To implement a MRU list in a menu, you will need to do the following: Decide on how to 'save' the information (XML file, registry entry). Personally, this is a good choice for a registry entry - this is how the Office suite actually store this information - check in regedit under: HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Common\Open Find\Microsoft Excel\Settings\Open\File Name MRU or HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU Then, in your applications 'Open' routine, simply add the last opened file to your internal MRU list, and save that list. Whenever populating the menu, dynamically read from this list and create menu items. There is no 'automatic' method of doing this - it is up to the end user to write the code to do so. It is not particularly tricky at all. B Quote
donnacha Posted January 18, 2005 Posted January 18, 2005 Be carefull that the end users security/spyware setup will allow you to modify the register. Isin't the registry being doneaway with in the next version of office. Either way you need to do some coding, nothing fancy comes cheap... Quote Hamlet
EFileTahi-A Posted January 18, 2005 Posted January 18, 2005 (edited) Once, I did a program with several ComboBoxes which would memorize all unique typed phrases into the Access DataBase. Everytime the program would be executed I just would tell it to reload all entryes into the corresponding ComboBoxes. No registry needed here. I used an Access Database to do this because the program used one, so, why not also use it to perform the memorizing thing? If the program would not be based on an database I would definitely use an string array to memorize the items, like this: // in declares public string[,] sObjectHistory = new string[x, y]; // x = number of objects plus one // y = number of historic items I would think it would be need it plus one The plus means I would add one more to memorize the most recent item used: sObjectHistory[x,0] = combobox1.SelecteedIndex And I also would memorize all items with a loop throught all the targets object items into to the stringArray. Then I would only need to save it to a file (I love binary format) and reload it everytime the program would start :) PS: Like previous users said, you will have to code to acomplish this :) PS2: I said 8 times the word "would" in this post :D Edited January 18, 2005 by EFileTahi-A Quote
eramgarden Posted January 18, 2005 Author Posted January 18, 2005 Hamlet is right..seems like this boss is going to be lots of fun.. Quote
eramgarden Posted January 19, 2005 Author Posted January 19, 2005 One more question: If I read it in XML or some other file..how do I get it under the "File" menu??? Quote
eramgarden Posted January 19, 2005 Author Posted January 19, 2005 I found this: http://www.codeproject.com/csharp/mrumenu.asp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.