Hi all

I have a form which selects files from the disk. But everytime a file gets selected the form gets closed. What should i do for the form 's selection window to remain so that the user can select multiple files everytime even without having to run the program each time a file has to be selected.

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WFAConvertor
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }
        private byte[] mBuffer;
        OpenFileDialog openFileDialog1 = new OpenFileDialog();

        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = "C:\\";
            openFileDialog1.Filter = "hex files (*.hex)|*.hex|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK);
            {
                intelhextobin();
            }
            
        }

        void intelhextobin()
{//
program logic.
}

Can anyone help with the code.

add openFileDialog1.MultiSelect = true; after line 27. And in line 31 you are going to have to pass the file names to your intelhextobin method.