Drew Wutka
DWUTKA at Marlow.com
Thu May 13 09:34:53 CDT 2010
John, I have two methods for tracking this sort of info in the main application I develop on (I'm not into developing much anymore). The application I am referring to is a networked app, that runs on every desktop at my company, so it is possible that the same user would use the app on different machines. So I determine if I want the 'feature' to be remembered by user, or by desktop. By user, I store the data in a table in the database, retrieved when the user logs in. By machine, I store the data in a text file that is loaded and saved when the app starts and stops. I don't have any controls moving around, but I do allow many forms to be resized, and so on the OnLoad event of each form I have a 'FormOpen Me' statement that runs a function with a reference to the form as an argument, which lets the function retrieve the size and position values based on the form name, from the text file data, and then apply that information to the form. On the Unload event, I have 'FormClose Me' which then records the values for the form to be saved in the text file. The app I refer too is a VB 6 app. I use a class module called 'LocalSettings' to store this data. Here's the .ini file that is on my desktop right now for this application: RAdminPath=C:\Program Files (x86)\Radmin Viewer 3\Radmin.exe frmPhoneList-Top=1875 frmPhoneList-Left=1875 frmPhoneList-Width=6780 frmPhoneList-Height=7005 When the app loads, it's populating a collection with the items on the left of the equal sign as the keys and the items on the right as the values. The 'LocalSettings' class simply retrieves, stores, and records those values without caring what they are. So on the FormOpen method, I simply have the following: Me.Top=MyLocalSettings.LocalProperty(Me.Name & "-Top") And so on. Obviously I have a line to determine that there is recorded info for the form, before it moves or resizes anything (the first time a form would be opened, there would be no info for it). The data I store in the database, so it would transfer from machine to machine, is actually less simple. Screen sizes and positions aren't things I would want globally stored because different machines can have different resolutions and monitor sizes. Drew -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Johncliviger at aol.com Sent: Sunday, May 09, 2010 1:24 PM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Moving controls at runtime Hi Guys, I need to permit users at runtime to move controls around a Form. And I've done that my using the Mouse Up, Move and Down events and it even works. Great! But I now need to save/persist those new XY location numbers. After much scratching of the old head I concluded that I should store them in Mysettings. The question is ..is that the best way to save the new settings and some pointers on how to code it will be most useful. A Sunday afternoon has passed without much progress and the dog is ignoring me due to the lack of a walk. TIA john cliviger O yes. I using vb.net 2005 _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.