/// <summary>
        /// Getting info from the form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void maudnaudbutton_Click(object sender, EventArgs e)
        {
            int flag   = 0;
            int states = 0;

            this.progressBar1.Value = 0;
            createInterfaceObject();  // assign the m_IProbe variable.
            m_IProbe.Initialize();    // get the trace buffer manager object to register itself
            int lane = 0;

            if (Lane1button.Checked)
            {
                lane = 1;
            }
            else if (Lane2button.Checked)
            {
                lane = 2;
            }
            else if (lane4button.Checked)
            {
                lane = 4;
            }
            Protocol = getprotocol();
            xmlreader();
            if ((int)EndStatenumericUpDown.Value == 0)
            {
                string   err   = "End State Box can not equal zero";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            else if ((int)EndStatenumericUpDown.Value < (int)StartStateNumericUpDown.Value)
            {
                string   err   = "Start State can not be greater than End State";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            if ((DP1_2SSTbutton.Checked == true || DP1_4SSTbutton.Checked == true) && getvc() == 0)
            {
                string   err   = "No Virtual Channel selected in MST mode";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            else
            {
                states = Convert.ToInt32(m_IProbe.GetNumberOfStates(getvc()));
            }
            this.progressBar1.Maximum = (int)EndStatenumericUpDown.Value;
            if (flag == 0)
            {
                getmaudnaud(lane);
            }
        }
        /// <summary>
        /// Go through state listing looking for state of Vertical Audio TimeStamp and filling out chart.
        /// </summary>
        /// <param name="lanes"></param>
        private void getmaudnaud(int lanes)
        {
            string V_Audio_TS = "0x64";
            int    vchannel   = getvc();
            int    i          = 0;

            byte[]      dum      = null;
            int         states   = (int)EndStatenumericUpDown.Value;
            List <uint> mauddata = new List <uint>();
            List <uint> nauddata = new List <uint>();
            int         lane     = 0;

            while (i <= states)
            {
                dum = m_IProbe.GetStateData(vchannel, i);
                StringBuilder sb = Geteventcode(dum);
                if (sb.ToString() == V_Audio_TS)
                {
                    extractdata(ref i, V_Audio_TS, ref mauddata, ref nauddata);
                }
                i++;
                this.progressBar1.Increment(1);
            }
            if (mauddata.Any() && nauddata.Any())
            {
                this.maudnaudchart.Series["Value"].Points.AddXY("Maud_Max", getmax(mauddata));
                this.maudnaudchart.Series["Value"].Points.AddXY("Maud_Min", getmin(mauddata));
                this.maudnaudchart.Series["Value"].Points.AddXY("Maud_Mean", getmean(mauddata));
                this.maudnaudchart.Series["Value"].Points.AddXY("Naud_Max", getmax(nauddata));
                this.maudnaudchart.Series["Value"].Points.AddXY("Naud_Min", getmin(nauddata));
                this.maudnaudchart.Series["Value"].Points.AddXY("Naud_Mean", getmean(nauddata));

                maudmaxtext.Text     = getmax(mauddata).ToString();
                maudmintext.Text     = getmin(mauddata).ToString();
                maudaveragetext.Text = getmean(mauddata).ToString();
                naudmaxtext.Text     = getmax(nauddata).ToString();
                naudmintext.Text     = getmin(nauddata).ToString();
                naudaveragetext.Text = getmean(nauddata).ToString();
            }
            else
            {
                string   e     = "No Maud or Naud data, Cant find Vertical Audio Time Stamp";
                Runerror error = new Runerror(e);
                error.Show();
            }
        }
        /// <summary>
        /// Reading in all data the user checked in the form and error checking
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createbutton_Click(object sender, EventArgs e)
        {
            Protocol = getprotocol();
            int flag = 0;

            this.progressBar1.Value = 0;
            createInterfaceObject();  // assign the m_IProbe variable.
            int states = 0;

            createInterfaceObject();  // assign the m_IProbe variable.
            m_IProbe.Initialize();
            if ((DP1_2SSTbutton.Checked == true || DP1_4SSTbutton.Checked == true) && getvc() == 0)
            {
                string   err   = "No Virtual Channel selected in MST mode";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            else
            {
                states = Convert.ToInt32(m_IProbe.GetNumberOfStates(getvc()));
            }
            int lane = 0;

            if (Lane1button.Checked)
            {
                lane = 1;
            }
            else if (Lane2button.Checked)
            {
                lane = 2;
            }
            else if (lane4button.Checked)
            {
                lane = 4;
            }
            xmlreader();
            if (string.IsNullOrEmpty(sampleratetext.Text) || sampleratetext.Text == "0")
            {
                string   err   = "Missing Sample Rate";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            if (string.IsNullOrEmpty(bitspersampletext.Text) || bitspersampletext.Text == "0")
            {
                string   err   = "Missing Bits per Sample";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            if (channel1checkbox.Checked == false && channel2checkbox.Checked == false)
            {
                string   err   = "Select Audio Channels";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            if ((int)EndStatenumericUpDown.Value == 0)
            {
                string   err   = "End State Box can not equal zero";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            else if ((int)EndStatenumericUpDown.Value < (int)StartStateNumericUpDown.Value)
            {
                string   err   = "Start State can not be greater than End State";
                Runerror error = new Runerror(err);
                error.Show();
                flag = 1;
            }
            else
            {
                this.progressBar1.Maximum = (int)EndStatenumericUpDown.Value;
            }
            if (flag == 0)
            {
                getaudio(lane);
            }
        }