Пример #1
0
        private void LoadOrderButton_Click(object sender, EventArgs e)
        {                                      //skip to product info form with all loaded data
            DialogResult responceDialogResult; //instantiat dialog checks

            //	Begin	in	the	project	folder.
            openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();
            //	Display	the	File	Open	dialog	box.
            responceDialogResult = openFileDialog1.ShowDialog();
            if (responceDialogResult != DialogResult.Cancel)
            {   //	User	didn’t	click	the	Cancel	button.
                //	Open	the	output	file.
                loadData = new StreamReader(openFileDialog1.FileName.ToString());
                //pass loadData info and closes stream
                while (loadData.Peek() != -1)
                {
                    computerSpecs.Add(loadData.ReadLine().ToString());
                }
                productForm.ComputerSpecs = computerSpecs;
                loadData.Close();
                //hide this form
                this.Hide();
                //show ProductInfoForm
                productForm.ShowDialog();
            }
        }