private void Open_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "text files (*.txt)|*.txt" }; if (openFileDialog.ShowDialog() == DialogResult.OK) { string fileName = openFileDialog.FileName; string[] textFile = File.ReadAllText(fileName).Split('&'); if (textFile[0] == "firstcommand") { SympleRaport raport = new SympleRaport(); raport.Initiate(textFile); raport.Show(); Hide(); } else if (textFile[0] == "secondcommand") { SecondRaport raport = new SecondRaport(); raport.Initiate(textFile); raport.Show(); Hide(); } } }
private void Open_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "text files (*.txt)|*.txt" }; if (openFileDialog.ShowDialog() == DialogResult.OK) { string fileName = openFileDialog.FileName; string[] textFile = File.ReadAllText(fileName).Split('&'); if (textFile[0] == "secondcommand") { Whom1.Text = textFile[1]; TextRaport1.Text = textFile[2]; Position1.Text = textFile[3]; Rank1.Text = textFile[4]; Name_1.Text = textFile[5]; Whom_2.Text = textFile[6]; TextRaport_2.Text = textFile[7]; Position_2.Text = textFile[8]; Rank_2.Text = textFile[9]; Name_2.Text = textFile[10]; } else if (textFile[0] == "firstcommand") { SympleRaport raport = new SympleRaport(); raport.Initiate(textFile); raport.Show(); Hide(); } else { MessageBox.Show("Error"); } } }