Creating INI file

  • Thread starter Thread starter Grace
  • Start date Start date
G

Grace

Hi,

How do I create/access an INI file in VB .NET? I
appreciate any help you can give me...

Thanks!
 
Grace said:
How do I create/access an INI file in VB .NET? I
appreciate any help you can give me...

Have a look at the Get* and Write* functions:
http://msdn.microsoft.com/library/en-us/sysinfo/base/registry_functions.asp


BTW, INI files are said to be obsolete:

<quote>
Note This function is provided only for compatibility with 16-bit
Windows-based applications, therefore this function should not be called
from server code. Applications should store initialization information in
the registry
</quote>


How to use pinvoke:
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconsumingunmanageddllfunctions.asp
http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconCallingWindowsAPIs.asp
 
Grace said:
Hi,

How do I create/access an INI file in VB .NET? I
appreciate any help you can give me...

Thanks!

Yes, INI files are out of date. But two facts here, let me point out
desktop.ini that still exists in WinXP. Also, INI files are a lot smaller
than thier XML replacements. I am thinking of switching over to XML myself
just because of the added features that XML offers. Also, alot of people
say "Use the registry". I've never been a huge fan of that, plus, I'm
testing out the Mono system, and I don't even want to think about the
nightmares WINE and MONO will have witha psudo-registry, so I'm staying
file-based.
There are alot of options, but it comes down to personal preference, and
no one should jump down anyone else's case for doing a personal preference.
My suggestion Grace, if you want to still use legacy INI files, use the
same API calls that VB6 would use, they work just fine. If you want to
stick with file-based user settings, look into XML files, the offer so much
more than a flat INI file would, but once again, it's personal preference.

HTH
Suefell
 
Yes, INI files are out of date. But two facts here, let me point out
desktop.ini that still exists in WinXP. Also, INI files are a lot smaller
than thier XML replacements. I am thinking of switching over to XML myself
just because of the added features that XML offers. Also, alot of people
say "Use the registry". I've never been a huge fan of that, plus, I'm
testing out the Mono system, and I don't even want to think about the
nightmares WINE and MONO will have witha psudo-registry, so I'm staying
file-based.

Mono is comming along very nicely... I'm currently working on a C#
wrapper for then libncurses.so on my Gentoo Linux box. I think if one
wants to stay as portable as possible, then XML based config files is
the best way to go. Using legacy INI API calls just complicates things
if you ever have to port.

And for those that don't know - VB.NET will run on Mono, though the mono
basic compiler (mbas) is not as complete as the C# compiler currently.
 
Tom Shelton said:
Mono is comming along very nicely... I'm currently working on a C#
wrapper for then libncurses.so on my Gentoo Linux box. I think if one
wants to stay as portable as possible, then XML based config files is
the best way to go. Using legacy INI API calls just complicates things
if you ever have to port.

And for those that don't know - VB.NET will run on Mono, though the mono
basic compiler (mbas) is not as complete as the C# compiler currently.

Good to hear that Mono's running, I have not as yet been able to get it
to install. I'm running SuSE 8.1 on a VMWare, and the problem I'm having
now is I had to install pkg-config, and now it's griping it can't find the
variable and glib-2.0 Fun LMAO
I really want to test out the mono-mod for Apache, that looks nifty to
say the least.

Suefell
 
Good to hear that Mono's running, I have not as yet been able to get it
to install. I'm running SuSE 8.1 on a VMWare, and the problem I'm having
now is I had to install pkg-config, and now it's griping it can't find the
variable and glib-2.0 Fun LMAO
I really want to test out the mono-mod for Apache, that looks nifty to
say the least.

Suefell

The ASP.NET implementation does look interesting, but I'm not normally a
web guy (at least not anymore - and when I was, I was doing CGI with
Perl). What I have been playing with is GTK# and now I'm using a lot of
P/Invoke to wrap the ncurses library.

If it's not to much trouble, I would switch distros. I had it running
on RH9 with not to much trouble and getting it running on Gentoo was
even easier:

emerge mono gtk-sharp

All done :) Mono is a really neat system. I hope that it doesn't
suffer a legal demise do to the MS patents on the .NET api.
 
Tom Shelton said:
The ASP.NET implementation does look interesting, but I'm not normally a
web guy (at least not anymore - and when I was, I was doing CGI with
Perl). What I have been playing with is GTK# and now I'm using a lot of
P/Invoke to wrap the ncurses library.

If it's not to much trouble, I would switch distros. I had it running
on RH9 with not to much trouble and getting it running on Gentoo was
even easier:

emerge mono gtk-sharp

All done :) Mono is a really neat system. I hope that it doesn't
suffer a legal demise do to the MS patents on the .NET api.

I really doubt they will because from my research, the CLR does not fall
under the .NET patent, because it was created by someone else and remains
opensource, so does C# technically, although MS bought the rights to it.
This is all from research, so it may be partially conjecture. It may come
down to be similar to the situation between Linux and Sun Microsystems, so
it's hard to tell.
Hope it sticks around, because even if Linux get's a major foothold on
the market, it will allow MS to continue to be a big player in the field of
programming architecture.

Suefell
 
* Tom Shelton said:
Mono is comming along very nicely... I'm currently working on a C#
wrapper for then libncurses.so on my Gentoo Linux box. I think if one
wants to stay as portable as possible, then XML based config files is
the best way to go. Using legacy INI API calls just complicates things
if you ever have to port.

It's time that somebody provides a _managed_ implementation of Window's
INI file access...

SCNR
 
It's time that somebody provides a _managed_ implementation of Window's
INI file access...

SCNR

Sounds like a good idea... When can I expect you to have that done? :)
 
* "Éric Moreau said:
I have created a small wrapper class around INI files (for compatibility
with older applications).

Have a look at http://www.utmag.com/May2003/Page59.asp

I was talking about a completely managed re-implementation of the
Windows p/invoke calls which can be easily ported to other platforms
that don't support the Windows API.
 
"Herfried K. Wagner [MVP]" <hirf-spam-me-
<SNIP>

Well, I'm working on a class that uses .cfx files. Basically, they are
XML implimentation of INI files, which provide the ability to have multiple
value for each key. I would love nothing more than to make this an API, but
that's not possible with VB.NET, or so I'm told. But, with it being a
class, I can shove that into a DLL, and then the Win32 API compatability is
no longer an issue, and it can be used under Mono/WinRack which has issues
with Windows Registry, or it could be used on Mac which has no registry.
Check back with me on my progress...

Sueffel
 
Back
Top