Storing application data?

  • Thread starter Thread starter EMonaco
  • Start date Start date
E

EMonaco

All,

I'd like to store application data, such as start up position, size, last
files used, user name and license key. Obviously there are a lot of choices,
such as registry, XML file, Isolate Storage, .INI files, etc. But what I
would really like is to store this data as part of the application assembly
itself. Especially for the username/license key- thus the actually
executable could be copied and run anywhere. Is this possible. Can you give
me an idea where to start? If not- what is the next best solution?


Regards,
Erin.
 
EMonaco said:
All,

I'd like to store application data, such as start up position, size, last
files used, user name and license key. Obviously there are a lot of choices,
such as registry, XML file, Isolate Storage, .INI files, etc. But what I
would really like is to store this data as part of the application assembly
itself. Especially for the username/license key- thus the actually
executable could be copied and run anywhere. Is this possible. Can you give
me an idea where to start? If not- what is the next best solution?

Users aren't usually given write access to installed programs...
 
Hello Erin,

I think you could refer to a new method named Dyanmic properties in .NET programming.

Dynamic properties in .NET provide an easy way to preserve property settings between instances of an application, without
having to resort to registry settings or .ini files. Visual Basic .NET provides a number of dynamic properties by default, and
you can easily make other properties dynamic by adding code.

For example, by default Windows Forms expose a number of dynamic properties such as MaximizeBox, MinimizeBox, and
ShowInTaskbar, but do not expose other useful properties such as Size or Location.

Dynamic properties work by storing property values in the application's configuration file's app.config for Windows
applications, web.config for Web applications. When a dynamic property is added in the Properties window, a key/value
pair is added to the appSettings section of the configuration file. In addition, a call to configurationAppSettings.GetValue is
added to the InitializeComponent procedure; the return value is used to set the initial value of the property. When you edit the
value in the configuration file, you alter the initial value of the property without having to modify the code in the
InitializeComponent procedure.

For details, please refer to one MSDN article named
"Creating Your Own Dynamic Properties and Preserve Property Settings in Visual Basic .NET"
at
http://msdn.microsoft.com/library/en-
us/dv_vstechart/html/vbtchCreateYourOwnDynamicPropertiesPreservePropertySettingsInVisualBasicNET.asp?frame=true.

In this article, you will learn how to set dynamic properties, how to make dynamic properties user-configurable, and how to
create new dynamic properties.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: "EMonaco" <[email protected]>
!Subject: Storing application data?
!Date: Sat, 16 Aug 2003 13:51:25 -0400
!Lines: 16
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <#[email protected]>
!Newsgroups: microsoft.public.dotnet.framework
!NNTP-Posting-Host: bgp01114046bgs.westln01.mi.comcast.net 68.42.93.214
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:51441
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!All,
!
! I'd like to store application data, such as start up position, size, last
!files used, user name and license key. Obviously there are a lot of choices,
!such as registry, XML file, Isolate Storage, .INI files, etc. But what I
!would really like is to store this data as part of the application assembly
!itself. Especially for the username/license key- thus the actually
!executable could be copied and run anywhere. Is this possible. Can you give
!me an idea where to start? If not- what is the next best solution?
!
!
!Regards,
!Erin.
!
!
!
!
 
Erin -
you may want to consider using a feature called "Isolated Storage". It will
allow you to create file streams isolated per application or per assembly.
Look under System.IO.IsolatedStorage namespace.
--Ivan
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top