private void SaveButton_Click(object sender, EventArgs e) { FileStream bStream = new FileStream(path, FileMode.Append); CSVLib.CsvFileWriter aWriter = new CSVLib.CsvFileWriter(bStream); List <string> dailyExpenseRecord = new List <string>(); dailyExpenseRecord.Add(amountText.Text); dailyExpenseRecord.Add(categorySelectText.Text); dailyExpenseRecord.Add(particularText.Text); aWriter.WriteRow(dailyExpenseRecord); amountText.Text = String.Empty; categorySelectText.Text = String.Empty; particularText.Text = String.Empty; bStream.Close(); }
private void saveButton_Click(object sender, EventArgs e) { FileStream aStream = new FileStream(path, FileMode.Append); CSVLib.CsvFileWriter aWriter = new CSVLib.CsvFileWriter(aStream); List <string> aDailyExpenseRecord = new List <string>(); aDailyExpenseRecord.Add(amountTextBox.Text); if (categoryEntryComboBox.Text == "House Rent") { aDailyExpenseRecord.Add(categoryEntryComboBox.Text); aDailyExpenseRecord.Add(particularEntryTextBox.Text); } else if (categoryEntryComboBox.Text == "Utility Bill") { aDailyExpenseRecord.Add(categoryEntryComboBox.Text); aDailyExpenseRecord.Add(particularEntryTextBox.Text); } else if (categoryEntryComboBox.Text == "Conveyance") { aDailyExpenseRecord.Add(categoryEntryComboBox.Text); aDailyExpenseRecord.Add(particularEntryTextBox.Text); } else if (categoryEntryComboBox.Text == "Grocery") { aDailyExpenseRecord.Add(categoryEntryComboBox.Text); aDailyExpenseRecord.Add(particularEntryTextBox.Text); } else if (categoryEntryComboBox.Text == "Misc") { aDailyExpenseRecord.Add(categoryEntryComboBox.Text); aDailyExpenseRecord.Add(particularEntryTextBox.Text); } aWriter.WriteRow(aDailyExpenseRecord); amountTextBox.Text = string.Empty; categoryEntryComboBox.Text = string.Empty; particularEntryTextBox.Text = string.Empty; aStream.Close(); }