473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1722
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*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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*******@hotm ail.com> wrote in message
news:uu******** *****@TK2MSFTNG P12.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
1570
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 know how to set the size of the textboxes? I tried setting the Width in the EditItemStyle but that had no affect. Any help....
7
6218
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 make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
27
5039
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 any solid reasons to prefer text files over binary files files?
26
4261
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 that work well. But there are two that I am having special difficulties with: 1)
3
480
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
2911
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
11926
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 in advance, Peter
12
2613
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 than one line and the text simply overlaps the sub-menus below it. I thought i had got around this by placing empty 'spacers' like so; oFoldMenu.make('sub3','')//spacer unfortunately, i have just viewed the site in IExplorer and it has added...
0
1000
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 UpdateGridData(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs) Dim objTextBox As TextBox
0
9544
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
9372
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
9324
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
9247
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
8243
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
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
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
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.