how to read a particular setting from a file

  • Thread starter Thread starter dotnet dev
  • Start date Start date
D

dotnet dev

Hi,

I have a plain text file called myVersions.ver which will have something
like this:

AppVersion: 1.0
DBVersion: 1.0

I will use this file to keep my app version number and database version.
My problem is that after extensive research I cannot figure out how to
read this file. I mean not simple read in which everything in file is
read as a stream. I want to specify that I want the setting
'AppVersion' or 'DBVersion'.

Basically:

1> I want to open this file
2> Query to read 'Appversion'

How can I do this. It's like reading a key in xml file.

Please Please help.


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Hi

Did you already look in the AssemblyInfo.vb class.

That is in my opinion the easiest way to get what you want to archieve,

I hope this helps?

Cor
 
* dotnet dev said:
I have a plain text file called myVersions.ver which will have something
like this:

AppVersion: 1.0
DBVersion: 1.0

I will use this file to keep my app version number and database version.
My problem is that after extensive research I cannot figure out how to
read this file. I mean not simple read in which everything in file is
read as a stream. I want to specify that I want the setting
'AppVersion' or 'DBVersion'.

Basically:

1> I want to open this file
2> Query to read 'Appversion'

How can I do this. It's like reading a key in xml file.

\\\
Imports System.IO
..
..
..
Dim sr As StreamReader = _
New StreamReader("C:\WINDOWS\WIN.INI")
Do While sr.Peek > -1
Dim strLine As String = sr.ReadLine()
Dim astrParts() As String = Strings.Split(strLine, ": ")
If astrParts.Length > 0 Then
If astrParts(0) = "AppVersion" Then
...
End If
End If
Loop
sr.Close()
///
 
Back
Top