473,394 Members | 1,773 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,394 software developers and data experts.

text file argent pls

23
Hi

can any one help me to write a string in spefic position in text file from vb6.
I want to search one string and write new one there
May 25 '07 #1
2 1053
Killer42
8,435 Expert 8TB
can any one help me to write a string in spefic position in text file from vb6.
I want to search one string and write new one there
I think the simplest way would be to Open the file in binary mode, Get the entire file into a String (see sample), use either Replace() function or Mid() function to replace the text, then Put the entire string back to the file. Note, the sample I quoted only shows how to read in the file, it will need a little modification to be able to write back to the file. But not much.

There are probably plenty of other methods you could use.
May 25 '07 #2
Mague
137 100+
A even easier way is the code bellow


Reads

Imports System.IO
Sub stuff
Dim strline as string
dim objstreamreader as streamreader

objstreamreader = New streamreader("C:\source")
strline = objstreamreader
do while not strline is nothing
msgbox(strline) ' Can use other way to write line
strline = objstreamreader
loop
objstreamreader.close()


Writes

Imports system I.O
sub stuff
Objstreamwriter as streamwriter
objstreamwriter = New Streamwriter("C:\source")
objstreamwriter.writeline("Top line to write")
objstreamwriter.writeline("Second line to write")
objstreamwriter.close()

Hope this helps u if not please dont yell at me im only 13 and havnt had any programing experience (yew i start next year)

Have Fun!
Mague
May 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
1
by: Rigga | last post by:
Hi, I am new to Python and need to parse a text file and cut parts out i.e. say the text file contained 5 rows of text: line 1 of the text file line 2 of the text file line 3 of the text...
3
by: Esmond | last post by:
Is there any free resource to do that? Thanks.
4
by: AHP | last post by:
Hi, I'm using Visual Studio 2005. I am developing a web application that uses the FileUpload control to upload text files to a directory on a webserver. This works fine. However, for me to be...
3
by: bbepristis | last post by:
Hey all I have this code that reads from one text file writes to another unless im on a certian line then it writes the new data however it only seems to do about 40 lines then quits and I cant...
3
by: R. P. | last post by:
Subject: XSLT to transform a flat XML file into a structured text file I have an XML file that lists the PDF file segment names and titles of a larger document and looks something like this: ...
2
by: Bsr | last post by:
Hi, Please tell the solutions for the following queries. 1. How to read the data from Excel file. 2. How to get the cell data in to the varaible from existed Excel file. Its very argent...
10
by: bluemountain | last post by:
Hi there, Iam new to python forms and programming too I had a text file where i need to extract few words of data from the header(which is of 3 lines) and search for the keyword TEXT1, TEXT2,...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...

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.