INI or XML

D

Daniel

Hi Group,

I need to store some app settings. I always used an INI file in VB6
using WritePrivateProfileString but I have read that XML is now the way
to do it with .NET

Any suggestions as which to use? I don't need to store anything
complicated so I just want the simplest solution!
 
C

Cor Ligthert

Daniel,

That depends, if it are really application settings (and not user settings),
than probably the registry is more the way, which is extremely simple to
handle in VBNet.

I hope this helps,

Cor
 
K

Ken Tucker [MVP]

Hi,

I prefer to use xml because you can databind the controls settings
to the xml file.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet02122002.asp

Ken
-------------------
Hi Group,

I need to store some app settings. I always used an INI file in VB6
using WritePrivateProfileString but I have read that XML is now the way
to do it with .NET

Any suggestions as which to use? I don't need to store anything
complicated so I just want the simplest solution!
 
D

Daniel

Daniel said:
Hi Group,

I need to store some app settings. I always used an INI file in VB6
using WritePrivateProfileString but I have read that XML is now the way
to do it with .NET

Any suggestions as which to use? I don't need to store anything
complicated so I just want the simplest solution!

Thanks. Although I am tempted to use an INI file I think I'll stick the
settings in the registry.
 
H

Herfried K. Wagner [MVP]

Daniel said:
I need to store some app settings. I always used an INI file in VB6 using
WritePrivateProfileString but I have read that XML is now the way to do it
with .NET

Any suggestions as which to use? I don't need to store anything
complicated so I just want the simplest solution!

Many people prefer XML files over standard INI files because of the "XML
hype". However, XML files suffer from the problem that XML was not designed
to be a human-readable data format. INI files are more readable and even an
"untrained" user will be able to edit them. Alternatively you can write the
data to the registry using 'SaveSetting'/'GetSetting' or the
'Microsoft.Win32.Registry' class. In addition to that you may want to store
the INI or XML file in an isolated storage.

Storing and loading user preferences
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=userpreferences&lang=en>
 
C

Carlos J. Quintero [.NET MVP]

Herfried K. Wagner said:
Many people prefer XML files over standard INI files because of the "XML
hype".

Apart from the hype, XML supports hierarchies of settings much better than
flat ini files...
However, XML files suffer from the problem that XML was not designed to be
a human-readable data format. INI files are more readable and even an
"untrained" user will be able to edit them.

XML is also human-readable, but much less readable than an .ini file,
certainly...

In any case IMO configuration files should not be edited by hand, only using
the app options window, not to mention edited by hand by untrained users...

Also, using a file instead of the registry makes the app more portable
between locations/computers, for the day when we will be able to install
apps again just XCOPYing them...old MS-DOS times ....

Just my 2 eurocents...

--
Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
D

Daniel

Herfried said:
Many people prefer XML files over standard INI files because of the "XML
hype". However, XML files suffer from the problem that XML was not
designed to be a human-readable data format. INI files are more
readable and even an "untrained" user will be able to edit them.
Alternatively you can write the data to the registry using
'SaveSetting'/'GetSetting' or the 'Microsoft.Win32.Registry' class. In
addition to that you may want to store the INI or XML file in an
isolated storage.

Storing and loading user preferences
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=userpreferences&lang=en>
precisely my point of view. The old "if it ain't broke..." This time
i'll use the registry but i am glad that INI files are not lost yet!
Besides, (dare i say it) I suspect that access to an INI file would be
quicker than the registry based purely on the size of the registry vs
the size of the INI file.

Thanks.
 
G

Guest

One method I like is to use a seralizable Class containing all the properties
as fields then serialize it to a file when the app is closed or whenever you
want to change something then unserialize it when the app is opened.

Personally, I don't like programmers messing with my registry, only
Microsoft. I know that many apps do but I still don't like it an when I port
a program to another computer, I can easily take my settings with me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

INI file 6
XML to save some settings 8
ini File? 5
System Configuration Help 3
.ini File 2
Create a configuration file (XML or INI) 5
XML to replace INI 7
reading connection string into a vb application... 3

Top