Thanks for you help but I'm still having a little difficulty appending the text file.
When I use the following code to update the txt file it replaces all the existing records in the txt file, I only want it to update a particular record.
FileReader inputStream = null;
FileWriter outputStream = null;
try {
inputStream = new FileReader("customers.txt");
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
try {
outputStream = new FileWriter("customers.txt", true);
} catch (IOException ex) {
ex.printStackTrace();
}
int c;
try {
while ((c = inputStream.read()) != -1) {
outputStream.write(c);
}
} catch (IOException ex) {
ex.printStackTrace();
}
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
if (outputStream != null) {
try {
outputStream.append(jTextField1.getText() + '|');
outputStream.append(jTextField2.getText() + '|');
outputStream.append(jTextField3.getText() + '|');
outputStream.append(jTextField4.getText() + '|');
outputStream.append(jTextField5.getText() + '|');
outputStream.append(jTextField6.getText() + '|');
outputStream.append(jTextArea1.getText() + '|');
outputStream.flush();
outputStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
any idea? Thanks
Marcus