[dba-VB] Application settings

Gustav Brock Gustav at cactus.dk
Fri Dec 4 11:24:46 CST 2009


Hi John

Shamil is right, but that method is for reading only.
Please note that the Properties' collection object is read-only, thus it takes quite a few steps to add a property:

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/c52b4fc6-66be-44ce-8a65-ab548f6f4f04

I have not used this as I haven't had any need to add properties on the fly. Reading and writing was fine for me, and new properties I added manually.

You may find it much easier and perhaps more convenient to just have a dataset which you read and write from/to an XML-file. I've posted code for this before.

/gustav


>>> jwcolby at colbyconsulting.com 04-12-2009 17:33 >>>
Under the project is a properties object.  Double click that and an entire multi-tabbed dialog opens.

Click the settings tab.  There you will see a form where you can enter name, type, scope, value.

As far as I can tell this is a place where I (the developer) can create settings that my program 
will use and manipulate, settings (for example) to tell my program the name of the SQL Server 
instance to use in a connection string, the name of my control database where I store my stored 
procedures and UDFs.  Stuff like that.  Stuff that I am currently hard coding, but which really 
should be in a settings tab so that I don't have to remember where that constant is in code, I can 
just go to the settings tab to change.

My expectation is that there is an object somewhere in the .net namespace that allows you to do 
something like "Something.Somethingelse.Settings["MyServerName"]...." to access these things.

I expect to be able to create new ones, edit existing ones, delete them etc from a .Net object.  I 
am looking for that .Net syntax that allows me to do this from code.

John W. Colby
www.ColbyConsulting.com 


Charlotte Foust wrote:
> OK, then I don't understand the question.  What do you mean about the settings "area" of the project?
> 
> Charlotte Foust 
> 
> -----Original Message-----
> From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: Friday, December 04, 2009 5:56 AM
> To: Discussion concerning Visual Basic and related programming issues.
> Subject: Re: [dba-VB] Application settings
> 
> Charlotte,
> 
> My question really is how do I get at the settings area of the project, and why would I not use that instead of this xml thing of yours?  At least in this specific case, I am writing code for myself, not distribution.
> 
> John W. Colby
> www.ColbyConsulting.com 





More information about the dba-VB mailing list