i am trying to write a code where the user enters delivery details into text box and the text gets added to a txt file (notepad txt file). This is my attempt, i get an extra line with " , ," why does it not add the text from textbox to the text file?
private void FrmDelivery_Load(object sender, EventArgs e)
{
if (theDelivery != null)
{
txtCustomerName.Text = theDelivery.customerName;
txtCustomerAddress.Text = theDelivery.customerAddress;
txtArrivalTime.Text = theDelivery.arrivalTime;
using (StreamWriter writer = new StreamWriter("visits.txt", true)) //true shows that text would be appended to file
{
writer.WriteLine(theDelivery.customerName + ", " + theDelivery.customerAddress + ", " + theDelivery.arrivalTime);
}
}
}