473,401 Members | 2,139 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,401 software developers and data experts.

Text editting in Vb.net, help.



I am reading in a text file of about 25 megs, using a streamreader
class. Now this text file was generated using a DataBUS programming
language, now known as PL/B, and being used as a database, that just
happens to be a flat text file. What I need to be able to do is to read
in a line from this text file, edit a few fields in this text stream
(which I can do), and then write the editted line back out at the same
formpointer position. I can do this easily by writing out to a seperate
file, but I'm hoping to write back out to the same file to prevent
dataloss. Any suggestions on how to use streamreader to read in a line
and then overwrite the previous line with the editted line at the same
form pointer position? Should I even be using the streamreader/writer
class, or should I be using the filestream class? Please help, I'm
lost..:(
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
3 1711
Read up on the BinaryReader and BinaryWriter classes.
You can open a Filestream (as you've done) then use the BinaryReader to read
a part of the file, then obviously the BinaryWriter to write data back to
the file. I only remember this because I did it today - and I know that
with the Binary classes you use Seek to move to any position within the
file. I'm not sure if you can do the same with the Filestream or
Textstream - Seek could be a function of the BaseStream - if you can it's
your preference.
_________________________________
The Grim Reaper

"Joshua Nunn" <me*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...


I am reading in a text file of about 25 megs, using a streamreader
class. Now this text file was generated using a DataBUS programming
language, now known as PL/B, and being used as a database, that just
happens to be a flat text file. What I need to be able to do is to read
in a line from this text file, edit a few fields in this text stream
(which I can do), and then write the editted line back out at the same
formpointer position. I can do this easily by writing out to a seperate
file, but I'm hoping to write back out to the same file to prevent
dataloss. Any suggestions on how to use streamreader to read in a line
and then overwrite the previous line with the editted line at the same
form pointer position? Should I even be using the streamreader/writer
class, or should I be using the filestream class? Please help, I'm
lost..:(
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2


Thanks dude, your a genius. Actually, the basestream method of the
streamreader/streamwriter classes actually allows you to access every
method (atleast at a glance) that you can normally access with a
filestream, which gives me position and seek, which works for my uses.
I appreciate the help.

--Josh

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3
:O Genius?? :O You jest :D

My IQ's only 147 according to Mensa :D :))
_____________________________
The Grim Reaper

"Joshua Nunn" <me*******@hotmail.com> wrote in message
news:uu*************@TK2MSFTNGP12.phx.gbl...


Thanks dude, your a genius. Actually, the basestream method of the
streamreader/streamwriter classes actually allows you to access every
method (atleast at a glance) that you can normally access with a
filestream, which gives me position and seek, which works for my uses.
I appreciate the help.

--Josh

*** 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

0
by: Pamela | last post by:
I have an ASP.NET webform with a datagrid on it. I have added an EditCommandColumn to the datagrid. When you click the Edit link the fields in the selected row appear in textboxes. Does anyone...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
27
by: Eric | last post by:
Assume that disk space is not an issue (the files will be small < 5k in general for the purpose of storing preferences) Assume that transportation to another OS may never occur. Are there...
26
by: sgershon | last post by:
Hi. I know this is should be a simple question. I know server-side web-programming, and never needed to use client-side scripting... until now :) I have done so far a little number of scripts...
3
by: FUGATO | last post by:
I need to help to wrap up text. I have a line all the text and I need to wrap the text with 40 characters each line but without using function. Somebody help me about that and give me an idea
4
by: Aaron Gray | last post by:
In theses JavaScript WYSIWYG editors how do they determine if and where there is marked (highlighted) text ? Many thanks in advance, Aaron
4
by: Peter | last post by:
Hi,everybody, I will edit a text file and another user maybe read it via LAN at any time. I want to lock the text file(no reading and writing) while I am editting. Anyone can help me? Thanks...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
0
by: Rod | last post by:
I want to be able to access the text in an edit text box which appears when editting a row in a datagrid Now I know that if you have a button column then you can do it like this. Sub...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...

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.