Click here to Skip to main content
15,908,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: Search a string Pin
Anthony Mushrow26-Nov-07 1:24
professionalAnthony Mushrow26-Nov-07 1:24 
GeneralRe: Search a string Pin
J4amieC26-Nov-07 1:34
J4amieC26-Nov-07 1:34 
GeneralRe: Search a string Pin
Dave Kreskowiak26-Nov-07 4:41
mveDave Kreskowiak26-Nov-07 4:41 
AnswerRe: Search a string Pin
Anthony Mushrow26-Nov-07 1:18
professionalAnthony Mushrow26-Nov-07 1:18 
GeneralRe: Search a string Pin
J4amieC26-Nov-07 1:37
J4amieC26-Nov-07 1:37 
JokeRe: Search a string Pin
Anthony Mushrow26-Nov-07 4:58
professionalAnthony Mushrow26-Nov-07 4:58 
AnswerRe: Search a string Pin
Pete O'Hanlon26-Nov-07 1:24
mvePete O'Hanlon26-Nov-07 1:24 
QuestionStreamWriter mistake Need help fast Pin
Kyle Maldonado26-Nov-07 0:56
Kyle Maldonado26-Nov-07 0:56 
I am new programer and for class I have to make a program that store employee data, writes them to a random access file (Employee.dat), be able to edit them, print reports, etc...

I am trying to write a line each time the user hits ADD on the enter employee form.

here is what I have

StreamWriter sw = null;
validation();
getInputValues(contact);
tring filename = "Employee.dat";
contact.MyFile = new FileStream(filename, FileMode.Append);

if (validation() == false)
{
contact.Close();
return;
}
else
{
{
try
{
sw = new StreamWriter(contact.FileName);

sw.WriteLine(contact.Serialize());

}
catch (Exception ex)
{
MessageBox.Show("eror saving contact" + contact.FileName + ex.Message);
}
finally
{
if (sw != null)
{
sw.Close();
}
}
lstContacts.Items.Add(contact.LastName + "\t" + contact.FirstName);

contact = null;
}
}
}
but it just writes over the previous employee (first line of the .dat file)
How do I make it so that it write on the next line.
Thanks for your help in advance
kyle

Kyle Maldonado

AnswerRe: StreamWriter mistake Need help fast Pin
m@u26-Nov-07 1:48
m@u26-Nov-07 1:48 
GeneralRe: StreamWriter mistake Need help fast Pin
Kyle Maldonado26-Nov-07 1:50
Kyle Maldonado26-Nov-07 1:50 
GeneralRe: StreamWriter mistake Need help fast Pin
m@u26-Nov-07 1:55
m@u26-Nov-07 1:55 
GeneralRe: StreamWriter mistake Need help fast Pin
Kyle Maldonado26-Nov-07 2:28
Kyle Maldonado26-Nov-07 2:28 
GeneralRe: StreamWriter mistake Need help fast Pin
m@u26-Nov-07 2:49
m@u26-Nov-07 2:49 
QuestionSend a string from one form to another forn Pin
Shaahinm26-Nov-07 0:43
Shaahinm26-Nov-07 0:43 
AnswerRe: Send a string from one form to another forn Pin
ZenyukIV26-Nov-07 0:59
ZenyukIV26-Nov-07 0:59 
GeneralRe: Send a string from one form to another forn Pin
Shaahinm26-Nov-07 1:11
Shaahinm26-Nov-07 1:11 
QuestionMessageBox - Increae font size Pin
dubbele onzin26-Nov-07 0:23
dubbele onzin26-Nov-07 0:23 
AnswerRe: MessageBox - Increae font size Pin
martin_hughes26-Nov-07 1:16
martin_hughes26-Nov-07 1:16 
QuestionHow to publish our own website Pin
GaneshKumarVkm26-Nov-07 0:09
GaneshKumarVkm26-Nov-07 0:09 
AnswerRe: How to publish our own website Pin
pmarfleet26-Nov-07 0:11
pmarfleet26-Nov-07 0:11 
QuestionHow to submit info programatically? Pin
sduhd26-Nov-07 0:07
sduhd26-Nov-07 0:07 
AnswerRe: How to submit info programatically? Pin
Andrei Ungureanu26-Nov-07 1:45
Andrei Ungureanu26-Nov-07 1:45 
GeneralRe: How to submit info programatically? Pin
sduhd26-Nov-07 13:31
sduhd26-Nov-07 13:31 
QuestionDictionary.ContainsKey Pin
Eli Nurman25-Nov-07 23:38
Eli Nurman25-Nov-07 23:38 
AnswerRe: Dictionary.ContainsKey Pin
Christian Graus26-Nov-07 0:00
protectorChristian Graus26-Nov-07 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.