private void Button_Click(object sender, RoutedEventArgs e) { // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.InitialDirectory = Worker.templates_dir; // Set filter for file extension and default file extension dlg.DefaultExt = ".txt"; dlg.Filter = "XML Files (*.xml)|*.xml"; // Display OpenFileDialog by calling ShowDialog method Nullable <bool> result = dlg.ShowDialog(); string filename = ""; // Get the selected file name and display in a TextBox if (result == true) { // Open document filename = dlg.FileName; TextBox.Text = filename; } Select_DPI new_window = new Select_DPI(); new_window.ShowDialog(); sheet = new Sheet(filename); lbl_id.Content = sheet.id; lbl_choices.Content = sheet.choice; lbl_questions.Content = sheet.questions; }
private void Button_Click(object sender, RoutedEventArgs e) { // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.InitialDirectory = Worker.templates_dir; // Set filter for file extension and default file extension dlg.DefaultExt = ".txt"; dlg.Filter = "XML Files (*.xml)|*.xml"; // Display OpenFileDialog by calling ShowDialog method Nullable<bool> result = dlg.ShowDialog(); string filename = ""; // Get the selected file name and display in a TextBox if (result == true) { // Open document filename = dlg.FileName; TextBox.Text = filename; } Select_DPI new_window = new Select_DPI(); new_window.ShowDialog(); sheet = new Sheet(filename); lbl_id.Content = sheet.id; lbl_choices.Content = sheet.choice; lbl_questions.Content = sheet.questions; }