private void buttonCreat_Click(object sender, RoutedEventArgs e) { try { PassengerName name = new PassengerName(); name.Name = textBoxData1.Text; DatePicker date = new DatePicker(); date.SelectedDate = DatePicker1.SelectedDate; date.DisplayDateStart = new DateTime(2 / 8 / 16); date.DisplayDateEnd = new DateTime(2 / 29 / 19); date.IsTodayHighlighted = true; filewritter1 filewriter = new filewritter1(); string PassengerInfo = null; if (radioMke.IsChecked == true) { PassengerInfo = (Environment.NewLine + this.textBoxData1.Text + " is leaving on " + this.DatePicker1 + " and the flight Origin and Destination is " + this.radioMke.Content); } else if (radioTpa.IsChecked == true) { PassengerInfo = (Environment.NewLine + textBoxData1.Text + " is leaving on " + this.DatePicker1 + " and the flight Origin and Destination is " + this.radioTpa.Content); } filewriter.Print(PassengerInfo, "Manifest.txt"); //this.Close(); MessageBox.Show(PassengerInfo); } catch (Exception ex) { MessageBox.Show(ex.Message); } }