private void InfoAboutRides_Click(object sender, EventArgs e) { foreach (Ride ride in this.rides.CompletedRides) { OutTextBox.AppendText("\n---------------------------------------------\n\r\n"); OutTextBox.AppendText($" Vehicle(LicenseOlate) {ride.Vehicle.LicensePlate}\r\n"); OutTextBox.AppendText($" Kilometres {ride.Kilometres}\r\n"); OutTextBox.AppendText($" Starting price {ride.StartingPrice}\r\n"); OutTextBox.AppendText($" Price of the ride {ride.PriceOfTheRide}\r\n"); OutTextBox.AppendText($" Starting time {ride.StartingTime}\r\n"); OutTextBox.AppendText($" Ending time {ride.EndingTime}\r\n"); OutTextBox.AppendText("\n---------------------------------------------\n\r\n"); } }
private void InfoAboutRidesFromFileButton_Click(object sender, EventArgs e) { try { using (StreamReader sr = new StreamReader("InfoAnoutRides.txt", System.Text.Encoding.Default)) { string line; while ((line = sr.ReadLine()) != null) { OutTextBox.AppendText(line + "\r\n"); } } } catch { MessageBox.Show("Error during the reading from file"); } }