read INI files without interop

I have an older (very older) vb6 system that we are moving into vb.net.  We have a lot of very needed INI files, that are very useful and may never be converted to xml or .config   We currently have interop methods to read them.  I would like to obsolete those and deprecate them.    I have written some rudimentary text parsing that work well with INI files that are exact or do not need a lot of parse.   Can anyone point me to open source examples, hopefully in vb or at least c#.
Charles BaldoSoftware DeveloperAsked:
Who is Participating?
 
Shaun KlineLead Software EngineerCommented:
You can find an example of the Streamreader here: http://msdn.microsoft.com/en-us/library/f2ke0fzy(v=vs.110).aspx
0
 
Shaun KlineLead Software EngineerCommented:
If you are taking the time to upgrade a VB6 application to VB.Net, you should reconsider changing the INI files to .config files, as these files were designed to replace the INI files. These .config files also, at least in VB 2005 +, allow your settings to act like objects with strict type casting.

If you choose not to go the .config route, another option would be to move these settings into a database table, as this would allow easy modification of the settings and near immediate access to the change to all installations (if you are not writing standalone applications).

If neither of these are desired, there are many file reading samples that can be found on the web. One approach is to use the StreamReader to open the file and read the contents.
0
 
ste5anSenior DeveloperCommented:
These .config files also, at least in VB 2005 +, allow your settings to act like objects with strict type casting.

+1
0
 
Éric MoreauSenior .Net ConsultantCommented:
Why don't you want to use GetPrivateProfileString? When working with old files, you need to use old mechanism.

Check http://emoreau.com/Entries/Articles/2003/05/Applications-Settings-in-VBNet.aspx
0
 
Charles BaldoSoftware DeveloperAuthor Commented:
Sean thats What I end up doing.

This is no small application, millions of existing lines of vb6 code.  The migration must be gradual
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.