datetime pickers2
<p>I am a beginner in programming. My question relates to using datetime pickers. I used the folderbrowserdialog in my program to access a number of files from a folder and then manipulated them to derive various outputs such as mean, minimum and maximum values etc. I then included datatime pickers and the folderbrowserdialog button in order to perform tasks on files for specific time periods. However, when the code runs, it request that I specify the location of the folder. The program then generates the required output, without requesting for the time interval for which I need the output for. How can I get the program to ask me to select the time interval after the selection of the folder that contains the csv files.  The code is below:</p>

<pre><code>namespace Filereader_m_15062012
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DialogResult result = folderBrowserDialog1.ShowDialog(); // Show the dialog.
            // create a list to insert the data into
            //put all the files in the root directory into array
            string[] fileEntries = Directory.GetFiles(folderBrowserDialog1.SelectedPath, "*.csv");

            // Display all files.
            TextWriter tw1 = new StreamWriter("C:/Users/a3708906/Documents/Filereader m 26062012 -2/Filereader m 22062012/listoffiles.txt");

            List&lt;string&gt; filenames = new List&lt;string&gt;();
            tw1.WriteLine("--- Files: ---");
            foreach (string path in fileEntries)
            {
                tw1.WriteLine(path);
            }

            tw1.Close();

            //int count = 0;
            //float sum = 0;

            string fileID1 =""; 
            List&lt;string&gt; fileID   = new List&lt;string&gt;();
            List&lt;string&gt; means = new List&lt;string&gt;();
            List&lt;string&gt; maximums = new List&lt;string&gt;();
            List&lt;string&gt; minimums = new List&lt;string&gt;();


            TextWriter tw2 = new StreamWriter("C:/Users/a3708906/Documents/Filereader m 26062012 -2/Filereader m 22062012/errorlist.txt");
            foreach (string path in fileEntries)
            {
                if (File.Exists(path))
                {  
                    string text = "";
                    // create a list to insert the data into
                    List&lt;float&gt; noise = new List&lt;float&gt;();
                    List&lt;DateTime&gt; time = new List&lt;DateTime&gt;();

                    TextWriter tw3 = new StreamWriter("C:/Users/a3708906/Documents/Filereader m 26062012 -2/Filereader m 22062012/rawdata.txt");

                    string file = path;

                    FileInfo src = new FileInfo(file);
                    TextReader reader = src.OpenText();
                    text = reader.ReadLine();

                    // while the text being read in from reader.Readline() is not null
                    while (text != null)
                    {
                        text = reader.ReadLine();

                        {
                            while (text != null)
                            {
                                text = reader.ReadLine();
                                if (text != null)
                                {
                                    string[] words = text.Split(',');
                                    noise.Add(Convert.ToSingle(words[3]));
                                    time.Add(Convert.ToDateTime(words[2]));
                                    fileID1 = words[1];

                                    // write text to a file
                                    tw3.WriteLine(text);
                                    //foreach (string word in words)
                                    //{
                                    //    tw.WriteLine(word);
                                    //}
                                }

                            }
                        }

                        tw3.Close();

                        TextWriter tw4 = new StreamWriter("C:/Users/a3708906/Documents/Filereader m 26062012 -2/Filereader m 22062012/noise.txt");

                        //float minValue = noise.Min();
                        float maxValue = Enumerable.Max(noise);
                        float mean = Enumerable.Average(noise); 
                        float minValue = Enumerable.Min(noise);
                        //float maxValue = noise.Max();
                        //float mean = noise.Average(); 

                        //foreach (float ns in noise)
                        {
                            //tw4.WriteLine(Convert.ToString(ns));
                            //count++;
                            //sum += ns;
                            //mean = sum / count; 

                            //float min1 = 0; 
                            //if (ns &gt; max) 
                                //max = ns; 
                            //else if (ns &lt; max) 
                                //min1 = ns; 
                            //if (min1 &lt; min &amp;&amp; min1 &gt; 0) 
                            //min = min1; 
                        }

                        tw4.Close();

                        fileID.Add(Convert.ToString(fileID1)); 
                        means.Add(Convert.ToString(mean));
                        maximums.Add(Convert.ToString(maxValue));
                        minimums.Add(Convert.ToString(minValue));
                    }                            
                }

                else
                {
                    tw2.WriteLine("{0}", path);
                }

                tw2.Close();
            }

            TextWriter tw5 = new StreamWriter("C:/Users/a3708906/Documents/Filereader m 26062012 -2/Filereader m 22062012/IDs.txt");
            tw5.WriteLine("FILE IDS");
            tw5.WriteLine("==========");
            foreach (string m in fileID)
            {
                tw5.WriteLine("MOTE {0}", (m));
            }

            tw5.Close();


            TextWriter tw6 = new StreamWriter("C:/Users/a3708906/Documents/Filereader m 26062012 -2/Filereader m 22062012/results.txt");
            tw6.WriteLine("File IDs" + "          " + "Means" + "          " + "Maximums" + "        " +  "Minimums");
            tw6.WriteLine("========" + "          " + "=====" + "          " + "========" + "        " +  "========");
            for (int i=0; i &lt; fileID.Count; i++)
                   {
                       int j = i;
                       tw6.WriteLine("Mote" + " " + Convert.ToString(fileID[i]) + "          " + Convert.ToString(means[j]) + "          " + Convert.ToString(maximums[j]) + "              " + Convert.ToString(minimums[j]));         
                    }

            tw6.Close();

        }       


        private void folderBrowserDialog1_HelpRequest(object sender, EventArgs e)
        {

        }


        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {

        }

    }
</code></pre>

<p>I wil be grateful for anybody's help with this. Thanks. </p>
