public static string LoadXMLFile_Click() { string p = FileModificatioclasses.LoadNewFileFromEx(); MainForm.filename = p; return(p); }
/** Implemented 23.2.2019 * This button load file by opening the Openfile Dialog box * 'LoadNewFileEx' open a new dialog box and copy the selected file path to a string * The string is a file path then send back to mainform * which load the content from the file and update the listbox * it also copy the path to address bar * */ public void LoadXMLFile_Click(object sender, EventArgs e) { p = FileModificatioclasses.LoadNewFileFromEx(); //p in declaration Console.WriteLine(p); MainForm.filename = p; FileAdress.Text = p; /* -----------------modified 28.2.2019--------------------*/ if (FileAdress.Text != String.Empty || FileAdress.Text != defaultfile) //added for default file Option 28.2.2019 { checkDefault.Enabled = true; checkDefault.Checked = false; FileAdress.Text = p; //stop from emptying the fileadress textbox if (FileAdress.Text != string.Empty) { label2.Text = MainForm.ShowHowmanyNumbers(p); //throw arg exception List <String> names = XmlMethods.getTheNames(FileAdress.Text); /* Should use update*/ d3.listContacts.DataSource = names; } } if (FileAdress.Text == string.Empty) //when file address in Empty { FileAdress.Text = defaultfile; checkDefault.Checked = false; checkDefault.Enabled = false; } if (FileAdress.Text == defaultfile) //when nothing select from load dialong { FileAdress.Text = defaultfile; checkDefault.Checked = true; checkDefault.Enabled = true; } /* -----------------modified 28.2.2019--------------------*/ }
private void button1_Click(object sender, EventArgs e) { FileModificatioclasses.LoadNewFileFromEx(); }