OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = " Xml (*.xml)|*.xml";
if (openFileDialog.ShowDialog() == DialogResult.OK)
string path = openFileDialog.FileName;
FormEdit FrmLoad = new FormEdit(path ) ;
NoQuit = 1; // Il s'agit de ma variable qui me permet de ne pas quitter l'appli quand je fais le this.close
this.Close(); // Pour fermer le menu principal afin de ne pas avoir 2 fenetres ouvertes en meme temps
FrmLoad.Text = "Edit from open "; //Vu que j'ai une seul form "edit" je personnalise un peu en disant qu'on vient du open
FrmLoad.ShowDialog(); // J'appel ma nouvelle form pour faire un nouveau scénario
public FormEdit(String editPath = null) { InitializeComponent(); }
public FormEdit(string path) { InitializeComponent(path); } private void FormEdit_Load(object sender, EventArgs e) { TextBox[] TextBoxs = { textBox1, textBox2}; Label[] labels = { label1, label2, label3, label4,}; Edit edit = new Edit(); // Création de l'objet OldValue = edit.LoadInitialDatas(TextBoxs, labels,path); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionpublic FormEdit(string path) { InitializeComponent(); chemin = path; }