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
Edited 4 Years Ago by VB 2012: Forgot the Fkn .... code -_- and posted the wrong code agian
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...