Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 14th, 2004, 10:17 AM
Authorized User
 
Join Date: Jun 2003
Location: Edinburgh, , United Kingdom.
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default Read data from ini file

Is there a way to read in data from an ini file for a windows application.  I was able to do this in VB6.

Oops forgot to say I need this for VB.NET.
Reply With Quote
  #2 (permalink)  
Old January 14th, 2004, 10:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: McPherson, Kansas, USA.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I missed something. What are you programming in VBA, VB.NET ???

Larry Asher
Reply With Quote
  #3 (permalink)  
Old January 14th, 2004, 10:23 AM
Authorized User
 
Join Date: Jun 2003
Location: Edinburgh, , United Kingdom.
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes its VB.NET Larry.  Sorry I forgot to post that on original message, which i've edited now.

Thanks
Reply With Quote
  #4 (permalink)  
Old January 14th, 2004, 10:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

This post probably belongs in the one of the .NET forums...

.INI files are not used in the .NET world; instead, they are replaced by .config files, which are XML documents which (among other things) contain key/value pairs. The System.Configuration namespace has classes which allow you to read (but not easily write) them.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
Reply With Quote
  #5 (permalink)  
Old January 15th, 2004, 09:16 AM
Authorized User
 
Join Date: Jun 2003
Location: Edinburgh, , United Kingdom.
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Jeff

Works well
Reply With Quote
  #6 (permalink)  
Old April 2nd, 2015, 06:14 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE: Read data from ini file

Even though XML based .config files are a preferred way, sometimes we don't have a choice. In that case you can use this VB.NET library that can read INI file's content and if needed update it as well.
It can also provide you a way to retrieve and use INI data in strongly typed manner, for example:
Code:
Dim ini As New IniFile()
ini.Load("Sample.ini")

Dim sampleInt As Integer
ini.Sections(0).Keys("Sample Number").TryParseValue(sampleInt)

Dim sampleDate As DateTime
ini.Sections(0).Keys("Sample Date").TryParseValue(sampleDate)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read data from an excel file diegoblin Beginning VB 6 6 September 1st, 2009 12:04 AM
Read Data from Excel File kiwibey ASP.NET 2.0 Professional 1 December 5th, 2006 11:27 AM
How to read and update .INI files using Pure C ?? Poonam C++ Programming 1 March 24th, 2005 01:22 AM
How to Read from INI file alen Pro VB 6 2 September 3rd, 2004 07:34 AM
Read data from a text file (*.txt) adriant42 Excel VBA 2 June 4th, 2004 07:32 PM



All times are GMT -4. The time now is 02:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.