please help,
Ive got as far on my own as i can and have hit a brick wall!


I am making a member application where members details can be input by text boxes and stored to a file, the code below works until i add more than one member!

The problem is when i add another member it just overwrites all the data currently in the file with the new member details and loses the old member details that used to exist in the file.

I would like the new member data to be added below the existing member data in the file, here is the code inside my save button:




//Start of btnSave

private: System::Void btnSave_Click(System::Object^ sender, System::EventArgs^ e) {

//btnSave Purpose: Open memberFile.dat and put in some data from text boxes

//save record to file
StreamWriter^ pwriter = gcnew StreamWriter("memberFile.dat");

pwriter->WriteLine(Convert::ToString(tempMemberNo));
pwriter->WriteLine(txtTitle->Text);
pwriter->WriteLine(txtFirstName->Text);
pwriter->WriteLine(txtLastName->Text);
pwriter->WriteLine(txtContactNo->Text);
pwriter->WriteLine(txtAddress->Text);
pwriter->Close();

lblError->Text = "Record Saved.";
}
}

//end of btnSave





When i move the "pwriter->Close();" code to the btnExit()
and move the "StreamWriter^ pwriter = gcnew StreamWriter("memberFile.dat");" code inside the formload(), My application saves multiple records like i would like it to.


But.. THE PROBLEM IS:
I would like the program to do the following when the btnSave is clicked:
Open the file.
Write data to the file. <-- below the data that is already there (Not wipe the file and +new data)
Close the file.





I want my file to contain the 1st members details and then the 2nd members details below the 1st and 3rd below the second ect..

like this:

1
mr
bob
marly
01803222244
17 madeup road, croydon, surrey.
2
miss
danniella
joevis
01803444555
74 chargrill road, madestone, kent.
3
...
.....
......
......
4
....
...
...
...
5
ect..