473,800 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to read a particular setting from a file


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!
Nov 20 '05 #1
3 1080
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
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.

Nov 20 '05 #2
* dotnet dev <de****@hotmail .com> scripsit:
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.I NI")
Do While sr.Peek > -1
Dim strLine As String = sr.ReadLine()
Dim astrParts() As String = Strings.Split(s trLine, ": ")
If astrParts.Lengt h > 0 Then
If astrParts(0) = "AppVersion " Then
...
End If
End If
Loop
sr.Close()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Thanks all.

dev

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
16677
by: Jim | last post by:
Hi, I am trying to figure out a way to implement a timeout along with a read() call on an open file. It only has to work on linux, for now I am trying: ret = select.select( ,,, timeout ) if ret == # do read
4
2378
by: Chuck Ritzke | last post by:
Hi, I've been using VS for a number of projects and the debugger has worked as advertised until now. I have a desktop solution with three projects, two of which are class modules. For some reason, in only one of them, the JIT debugger doesn't seem to be working. (At least I asssume this is a JIT debugger issue.) Anyways, in all my other projects an error causes the pop-up window with the break button option that breaks at the line...
2
4070
by: GB | last post by:
Hi Everybody! I have 2 different processes/application. One is writing to a file and another is reading from it. For some reason the code doesnt seems to work and gives mscorlib.dll IOException error "This file is being used by another process". Both the applications are in C#. P.S. Even if I try to open the file with NotePad (while my server is writing data in the file)it gives the same error.
2
5420
by: rrossney | last post by:
Please look at the "what I've already done" section of this message before responding to it: I believe that I've done everything that the people who experience this error are typically told to do. I have created an ASP.NET web service that I have running on my development machine, and am trying to get it to run on my test server. Both machines are running Windows 2000 SP4, IIS 5, and the .NET 2.0 framework. When I attempt to access...
0
1617
by: tjonsek | last post by:
I am working with directories in PHP for the first time. I have code that I've changed multiple times to try different things. I would think this is pretty standard fare so I'm not sure why I can't seem to get it right. What I would like to see happen: The code opens the directory and loops through the files, opening them and processing them.
3
8283
by: eholz1 | last post by:
Hello PHP Group, I am having trouble setting permissions correctly so that the magickwand api (php 5.2) can read and write images. I usually read a file from one directory, create a magickwand resource from that file, and transform the image, and save the new image with a new name to a different directory. I have seen that my file and folder permissions when set incorrectly,
1
1510
by: dsudhakara | last post by:
In my queues.conf file my text message are stored here .I want to retrieve particular campaign modify some words in particular campaign and return to save the same queues.conf file .Plz give me coding. example queues.conf ---------------------------------------------------------------- eventwhencalled = yes strategy = leastrecent timeout = 10 wrapuptime = 1
2
5350
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi Is there any way to Read an INIFile from a string or Stream instead of a physical file ??? I want to read the INIFile into a string then store in a db but when I read the string from the db or save string to the db I don't want to have to copy the string to a file to use the WritePrivateProfileString and GetPrivateProfileString. Is there a way around this instead of writing my own class to operate on a string or stream ???
3
11532
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I'm creating an application that will read emails from GMail, using the System.Net.Sockets.TcpClient and POP protocol. However, I am having a problem with my SslStream. After I create the TcpClient, I create my SslStream... stream = new System.Net.Security.SslStream(tcpclient.GetStream()...);
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.