Разработка программы с целью обработки и сортировки чисел, страница 6

            {

                if (tbInData.TextLength >= 4) textBox1.Enabled = true;

                return;

            }

            if (e.KeyChar == '.') bStart_Click(sender, e);

            else

            {

                tClock.Stop();

                MessageBox.Show("Обнаружен неправильный символ!");

                tClock.Start();

                Error = true;

            }

        }

        private void label1_Click(object sender, System.EventArgs e)

        {

        }

        private void textBox1_TextChanged_1(object sender, System.EventArgs e)

        {

            if (Error)

            {

                Error = false;

                string S;

                int L;

                S = textBox1.Text;

                L = textBox1.TextLength;

                textBox1.Text = S.Substring(0, L - 1);

                textBox1.SelectionStart = L - 1;//Позиция курсора

            }

        }

        private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)

        {

            tClock.Stop();

            tClock.Start();

            if ((e.KeyChar >= '0') & (e.KeyChar <= '9')) return;

            if (e.KeyChar == '.') bStart_Click(sender, e);

            else

            {

                tClock.Stop();

                MessageBox.Show("Обнаружен неправильный символ!");

                tClock.Start();

                Error = true;

            }

        }

        private void myExit_Click(object sender, EventArgs e)

        {

            Close();

        }

        private void miAbout_Click(object sender, EventArgs e)

        {

            Hallo.Show();

        }

        private void miOpen_Click(object sender, EventArgs e)

        {

            if (ofdOpen.ShowDialog()==DialogResult.OK)

            {

                MessageBox.Show(ofdOpen.FileName);

                this.MyObject.OpenFileNameWrite(ofdOpen.FileName);

                this.MyObject.ReadFromFile(lb_read);

                            }

                            button1.Enabled = true;

                            listBox1.Items.Clear();

                            listBox2.Items.Clear();

                            listBox3.Items.Clear();

                            listBox4.Items.Clear();

                        }

        private void miSaveAs_Click(object sender, EventArgs e)

        {

            if (sfdSave.ShowDialog() == DialogResult.OK)

            {

                MessageBox.Show(sfdSave.FileName);

                this.MyObject.SaveFileNameWrite(sfdSave.FileName);

                this.MyObject.WriteInFile();

            }

        }

        private void textBox1_TextChanged_2(object sender, EventArgs e)

        {

        }

        private void miSave_Click(object sender, EventArgs e)

        {

            if (MyObject.IsFileHere())

                this.MyObject.WriteInFile();

            else

                miSaveAs_Click( sender, e);

        }

        private void stdOpen_FileOk(object sender, CancelEventArgs e)

        {

        }

        private void fMain_FormClosed(object sender, FormClosedEventArgs e)

        {

            MessageBox.Show((System.DateTime.Now - this.MyObject.GetTime()).ToString());

        }

        private void пToolStripMenuItem_Click(object sender, EventArgs e)

        {

            Search form_searching = new Search(this.MyObject.GetOpenFile());

            form_searching.Show();

        }

        private void button1_Click(object sender, EventArgs e)

        {

            for (int i = 0; i < lb_read.Items.Count; i++)

            {

                listBox1.Items.Add(lb_read.Items[i]);

                listBox2.Items.Add(lb_read.Items[i+1]);

                i += 4;

            }

            button3.Enabled = true;

            button4.Enabled = true;

        }

        private void button2_Click(object sender, EventArgs e)

        {

            listBox1.Items.Clear();

            listBox2.Items.Clear();

            foreach (object value in listBox3.Items)

                listBox1.Items.Add(value);

            foreach (object value in listBox4.Items)

                listBox2.Items.Add(value);

            listBox3.Items.Clear();

            listBox4.Items.Clear();

            int len_max1 = 0;

            int len_max2 = 0;

            string temp;

            foreach (object value in listBox1.Items)

                if (len_max1<value.ToString().Length)

                {

                    len_max1 = value.ToString().Length;

                }

            foreach (object value in listBox2.Items)

                if (len_max2 < value.ToString().Length)

                {

                    len_max2 = value.ToString().Length;

                }

            foreach (object value in listBox1.Items)

            {

                temp = value.ToString();

                while (temp.Length < len_max1)

                    temp = " " + temp;

                listBox3.Items.Add(temp);

            }

            foreach (object value in listBox2.Items)

            {

                temp = value.ToString();

                while (temp.Length < len_max2)

                    temp = " " + temp;

                listBox4.Items.Add(temp);

            }

            listBox3.Sorted = true;

            listBox4.Sorted = true;

        }

        private void button5_Click(object sender, EventArgs e)

        {

            if (openFileDialog1.ShowDialog() == DialogResult.OK)

            {

                FileStream FS=new FileStream(openFileDialog1.FileName,FileMode.Open);

                StreamReader SR = new StreamReader(FS);

                string s;

                while ((s = SR.ReadLine()) != null)

                    listBox3.Items.Add(s);

                SR.Close();

                FS.Close();

            }

        }

        private void button6_Click(object sender, EventArgs e)

        {

            if (openFileDialog2.ShowDialog() == DialogResult.OK)