Try running this. You may need to add some error checking or tests for blank lines or comments depending on how strictly you control the format of your ini file.
Private Sub btnRead_Click(sender As System.Object, e As System.EventArgs) Handles btnRead.Click
Dim file As String = "d:\temp\settings.ini"
Dim sr As New System.IO.StreamReader(file)
Do Until sr.EndOfStream
Dim line As String = sr.ReadLine()
If line.StartsWith("[") Then
Debug.WriteLine("SECTION: " & line)
Dim pair() As String = line.Split("=")
Debug.WriteLine(Trim(pair(0)) & " is " & Trim(pair(1)))
A more robust solution would be to create your own Class to read/write ini files. The class could store the entire file as an internal data structure and you could have methods to access/add/delete/read/write. Perhaps a search on Google would turn up such a class already written and debugged.
Here's my example through what ive found on other sites and my own editing and also converted from C# -_-
And was not low class C# XD
Public Sub read()
Dim GetIniValue As String = ""
Using MBINILOC As New IO.StreamReader(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\Moonbase Hack Utility\MoonbaseSettings.ini")
Dim CurrentLineInMBINI As String = ""
CurrentLineInMBINI = MBINILOC.ReadLine
If CurrentLineInMBINI.Contains("Password=") Then
GetIniValue = CurrentLineInMBINI
Loop Until CurrentLineInMBINI Is Nothing
by VB 2012: Forgot the Fkn .... code -_- and posted the wrong code agian
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...