G
Gaby Sandoval
I have this code.
The user can read teh record from the text file just fine. They can
click the NEXT button and it reads the next record (which is just the
next line from the text file).
If the user makes changes to a record using the application they have
to option to click the APPEND button to overwrite there changes on the
file. The file has a line of text for each record....... Here is the
code for when they click the APPEND button:
If filename = String.Empty Then
MessageBox.Show("No file has been selected this session."
& ControlChars.NewLine & "Please click 'Read First Record' to load
file.", "File Absence", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
response = cdlOpenFile.ShowDialog
Do While response = Windows.Forms.DialogResult.Cancel
MessageBox.Show("No file was selected." &
ControlChars.NewLine & "Please select file to append record to.",
"File Absence", MessageBoxButtons.OK, MessageBoxIcon.Error)
response = cdlOpenFile.ShowDialog
Loop
appendfilename = cdlOpenFile.FileName
My.Computer.FileSystem.WriteAllText(appendfilename, Name&
", " & Address & ", " & City & ", " & State & ", " & Zip, True)
End If
This only adds a line to the end of the document. If set to false, it
erases all the other lines of the text file. How do I get it to only
replace the one line that they are reading.
The user can read teh record from the text file just fine. They can
click the NEXT button and it reads the next record (which is just the
next line from the text file).
If the user makes changes to a record using the application they have
to option to click the APPEND button to overwrite there changes on the
file. The file has a line of text for each record....... Here is the
code for when they click the APPEND button:
If filename = String.Empty Then
MessageBox.Show("No file has been selected this session."
& ControlChars.NewLine & "Please click 'Read First Record' to load
file.", "File Absence", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
response = cdlOpenFile.ShowDialog
Do While response = Windows.Forms.DialogResult.Cancel
MessageBox.Show("No file was selected." &
ControlChars.NewLine & "Please select file to append record to.",
"File Absence", MessageBoxButtons.OK, MessageBoxIcon.Error)
response = cdlOpenFile.ShowDialog
Loop
appendfilename = cdlOpenFile.FileName
My.Computer.FileSystem.WriteAllText(appendfilename, Name&
", " & Address & ", " & City & ", " & State & ", " & Zip, True)
End If
This only adds a line to the end of the document. If set to false, it
erases all the other lines of the text file. How do I get it to only
replace the one line that they are reading.