1
Answer

c# opendialogbox

David Smith

David Smith

14y
2.1k
1
Hi, Can someone give me some assistance with the dialog box, I want to be able to select multiple files at once , instead of one file at a time, How do I go by doing that.

the code snippet that i have so far below

        public OpenFileDialog Cif_OpenDialogBox(OpenFileDialog openFileDialog1)
        {
             if (openFileDialog1.ShowDialog() == DialogResult.OK)
             {
                    Stream myStream;
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        // Insert code to read the stream here.
                        Console.WriteLine(openFileDialog1.FileName);
                        myStream.Close();
                    }
              }
             return openFileDialog1;
        }
        public SaveFileDialog Cif_SaveDialogBox(SaveFileDialog saveFileDialog1)
        {
            saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Stream myStream;
                if ((myStream = saveFileDialog1.OpenFile()) != null)
                {
                    // Insert code to read the stream here.
                    //saveFileDialog1.FileName = textBox1.Text;
                    Console.WriteLine(saveFileDialog1.FileName);
                    myStream.Close();
                }
            }
            return saveFileDialog1;
        }

Answers (1)