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

Editing file data.

Hi,
Bit of a noobie question I'm afraid....

I have a program to open a file,read out part of each record to a text box, make a selection then extract the entire record. This works OK.

Now I require to edit and replace the record. (Each field in the file uses commas as delimiters.)

Attempting to replace a record either appends the file or overwrites the whole lot, so that I get a file with just my edited record in it.

Can anyone suggest a way to do it correctly?

If possible I would like to use a similar method of writing as reading.
The method I am using to read is:

Dim x As Integer = 0
Dim AClass As String
Dim currentRow As String()
Dim rowlen As Integer

Using Myreader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser("SBDa ta_Class.dat")
Myreader.TextFieldType = FileIO.FieldType.Delimited
Myreader.SetDelimiters(",")

While Not Myreader.EndOfData
'pull out records and write to textbox

Try
currentRow = Myreader.ReadFields
rowlen = currentRow.Length

For x = 0 To rowlen - 1
AClass = currentRow(x)
ListBox3.Items.Add(AClass)
Next

Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineExceptio n
MsgBox("Line " & ex.Message & _
"is not valid and will be skipped.")
End Try
End While
End Using

End Sub

Any help greatly appreciated,
Phil
Dec 10 '06 #1
0 872

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

Similar topics

4
by: Jerry Khoo | last post by:
i am currently working on an assignment that requires the program to manage the files like editing file content, modifying file content, and deleting file contents. My question is what sort of...
1
by: pratyush.aditya | last post by:
hi, can anybody tell me what are the steps and procedures that are to be taken for video editing like frame extraction etc from avi,mpeg files using C programming.
8
by: Sam Collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8"...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
8
by: D | last post by:
Hi, I currently have a Python app with a Tkinter GUI frontend that I use for system administration. Everytime it launches, it reads a text file which contains info about each host I wish to...
2
by: ritesh | last post by:
Hi, I'm facing a problem in which I need to edit an already created file, and the editing needs to be done at the start of the file rather then appending to the file. OS - Linux,Solaris ...
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
5
by: Tim Mackey | last post by:
hi, i have put my web.sitemap in /App_Data so i can edit it programatically via a web admin page, inheriting the modify permissions from the App_Data folder etc. i was hoping the provider would...
10
by: Ikolder | last post by:
Hello, I hope someone can help me with this! I have a problem editing a text file my file looks like this 11 13 15 16 23
0
by: ee0jmt | last post by:
Hopefully an easy question: Using vb.net I have opened an xml file (which is encrypted) retreived the file information as a string, carry out some editing of the xml data. I now want to produce a...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.