private void fileToolStripMenuItem_Click(object sender, EventArgs e) { Form5 ipForm = new Form5(this, true); ipForm.Show(); }
private string getIpFromFile() { string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string iniFile = directory + "\\config.ini"; if(File.Exists(iniFile)) { string configFile = System.IO.File.ReadAllText(iniFile); string ip = Regex.Match(configFile, "(?=<ip>)(.*?)(?=</ip>)").ToString().Substring(4); Form2 subForm = new Form2(this); this.TopLevel = false; subForm.TopMost = true; subForm.Show(); return ip; } else { Form5 ipForm = new Form5(this, false); this.TopLevel = false; ipForm.TopMost = true; ipForm.Show(); return ""; } }