VB Code:
Dim fs As System.IO.FileStream = New System.IO.FileStream(System.IO.Path.Combine(Application.StartupPath, "Main Config.ini"), IO.FileMode.OpenOrCreate)
Dim sr As New System.IO.StreamReader(fs)
Dim contents As String = sr.ReadToEnd
sr.Close()
fs.Close()
sr = Nothing
fs = Nothing
VB Code:
'At the top
Imports System.IO 'works kind of like a giant With..End WIth
Dim fs As FileStream = New FileStream(Path.Combine(Application.StartupPath, "Main Config.ini"), FileMode.OpenOrCreate)'Opens file
Dim sr As New StreamReader(fs)'here is an object to read it
Dim contents As String = sr.ReadToEnd'reads the whole file to the string
sr.Close()' clean up
fs.Close()
sr = Nothing
fs = Nothing