473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

[VB2008] How to replace lines in a textfile?

Hi,

I'm pretty new with VB, especialy with 2008 Express :-p So i need your
help...

I have a text file containing:

VERSION 3
ADDEDVERSION 5
OPTION_GUILD_RECRUITMENT_CHANNEL AUTO
CHANNELS
guild 1 3
dutchworld 1 4
WorldTrade 1 5
GMhelp 1 6
END
ZONECHANNELS 16777216
COLORS
SAY 255 255 255
....
....

And i want to replace the part between CHANNELS and END
I allready found a way to read those lines and change it in the way i want
and put it in an array ( Dim channel_names(0 To 10) As String )

Now i want to replace those 4 lines with my array.

Does anyone has an idea to do this?
Or can anyone give me some hints or examples?

Thanks,
Maurice
Nov 27 '07 #1
1 1622
"Maurice van 't Loo" <no****@nospam.nlschrieb
Hi,

I'm pretty new with VB, especialy with 2008 Express :-p So i need
your help...

I have a text file containing:

VERSION 3
ADDEDVERSION 5
OPTION_GUILD_RECRUITMENT_CHANNEL AUTO
CHANNELS
guild 1 3
dutchworld 1 4
WorldTrade 1 5
GMhelp 1 6
END
ZONECHANNELS 16777216
COLORS
SAY 255 255 255
....
....

And i want to replace the part between CHANNELS and END
I allready found a way to read those lines and change it in the way
i want and put it in an array ( Dim channel_names(0 To 10) As String
)

Now i want to replace those 4 lines with my array.

Does anyone has an idea to do this?
Or can anyone give me some hints or examples?
Put 'em in a List(Of String) and you can remove and add items using the Add,
AddRange and RemoveAt methods.
Armin

Nov 27 '07 #2

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

Similar topics

7
by: Hans A | last post by:
I have a textfile "textfile.txt" containing a list of words. There is one word on each line. I want to pick two random lines from this textfile, and I have tried to do something like: //Loading...
9
by: Justme | last post by:
Novice programmer needs help with using fgets to read and ignore the first two lines of a file. I've gone thru the previous posting regarding fgets, but none of them seems to help my situation. I...
4
by: alexvorn2 | last post by:
Hi! I use VB 2008 and I want to ask you how I can replace the text that is between "*" and "*" in a text file? If text file contains this: *dog* *cat* *bird* *lion* *something* .....end of...
3
by: kris06 | last post by:
Hi All, I have a textfile and i need to format it, so that i can import it to the mysql database. The textfile contains 9 colums of data separated by a space. I want to replace only the...
6
by: Scott Gravenhorst | last post by:
Windows XP SP3 My application is set to open a SaveFile dialog when an exit is requested. When I click the app's close button, the save dialog opens, but when I click to change the folder, the...
4
by: BibI | last post by:
Hi there, I just started programming with PERL and am trying to put together my first little data manipulation program. I am working on a MAC with OSX. I have a data file with the following...
10
by: Gilbert Tordeur | last post by:
Bonjour. N'y aurait-il pas depuis la VB8 un moyen d'assigner en une seule instruction l'ensemble des propriétés d'un objet aux propriétés de mêmes noms d'un autre objet, plutôt que d'écrire la...
2
by: John Whitworth | last post by:
Hi, I'm rewriting an old VB6 app of mine in VB2008. All has been going well with calls to winscard.dll, until I needed to send an array of bytes as part of a structure. When using a winscard...
0
by: John Dann | last post by:
Looking to migrate from VB2005 Pro to VB2008. Can anyone suggest/recommend a VB2008 book that highlights the changes from earlier versions of VB.Net (VB2003/2005) rather than describing VB2008...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...

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.