if (infile != null)
{
infile.Close();
}
if (reader != null)
{
reader.Close();
}
//Creating a File Stream object to Open a file called FILENAME for writing
outfile = new FileStream(FILENAME, FileMode.Append, FileAccess.Write);
//Creating a Stream Writer with the outFile File Stream object
writer = new StreamWriter(outfile);
writer.Write("Income : $");
writer.WriteLine(Convert.ToString(Income));
writer.Write("Less: Expense : $");
writer.WriteLine(Convert.ToString(Expenses));
writer.Write("Add Trade : $");
writer.WriteLine(Convert.ToString(trade));
writer.Write("Add Other Income : $");
writer.WriteLine(Convert.ToString(addotherincome));
writer.Write("Less Donation : $");
writer.WriteLine(Convert.ToString(donation));
writer.Write("Less Interest : $");
writer.WriteLine(Convert.ToString(interest));
writer.Write("Less Dividends : $");
writer.WriteLine(Convert.ToString(dividends));
writer.Write("Less Parenthood Rebates : $");
writer.WriteLine(Convert.ToString(parenthood));
writer.Write("Less Employment Expenses : $");
writer.WriteLine(Convert.ToString(employment_expenses));
writer.Write("Less NS man Relief : $");
writer.WriteLine(Convert.ToString(nsman));
writer.Write("Earned Income Relief : $");
writer.WriteLine(Convert.ToString(e_incomerelief));
writer.Write("Chargable Income : $");
writer.WriteLine(Convert.ToString(chargeableincome));
writer.Write("Personal Relief : $");
writer.WriteLine(Convert.ToString(personal_relief));
writer.Write("Tax Payable : $");
writer.WriteLine(Convert.ToString(Tax));
outfile.Seek(0, SeekOrigin.End);
writer.Close();
outfile.Close();
this is my code to declare the writer.
but how do i get those information in the lines and read it into a textbox... im using this code...
//Creating a File Stream object to Open a file called FILENAME for writing
infile = new FileStream(FILENAME, FileMode.Open, FileAccess.Read);
//Creating a Stream Writer with the outFile File Stream object
reader = new StreamReader(infile);
try
{
recordIn = reader.ReadLine();
RecArray = recordIn.Split(DELIM);
income_tb.Text = RecArray[0];
expense_tb.Text = RecArray[1];
but it can only read the first line...
HELP