Exemple #1
0
        private void Set()
        {
            if (this.nRows == 0)
            {
                MessageBox.Show("Generate data first.");
                return;
            }
            try
            {
                int    row = Row;
                int    col = Col;
                string val = CalcValue.ToString();

                this.data[row, col] = val;

                ShowObject();
            }
            catch (IndexOutOfRangeException ex1)
            {
                MessageBox.Show("Please enter a valid row and column index.\r\nException: " + ex1.Message);
            }
            catch (FormatException ex2)
            {
                MessageBox.Show("Please enter a valid row and column index.\r\nException: " + ex2.Message);
            }
        }
Exemple #2
0
        private void ExecuteSetCommand(object param)
        {
            if (NRows == 0)
            {
                MessageBox.Show("Generate data first.");
                return;
            }

            try
            {
                int    row = Row;
                int    col = Col;
                string val = CalcValue.ToString();
                if (this.nRows != row && this.nCols != col)
                {
                    data[row, col] = val;
                }
                else
                {
                    MessageBox.Show("Please enter a valid row and column index.\nThis field is belongs to Sum of the rows and columns");
                }

                ShowObject();
            }
            catch (IndexOutOfRangeException ex1)
            {
                MessageBox.Show("Please enter a valid row and column index.\r\nException: " + ex1.Message);
            }
            catch (FormatException ex2)
            {
                MessageBox.Show("Please enter a valid row and column index.\r\nException: " + ex2.Message);
            }
        }
Exemple #3
0
 private void buttonEqualization_Click(object sender, EventArgs e)
 {
     if (textEkran.Text != "")
     {
         double temp;
         if (labelTemp.Text.EndsWith("+"))
         {
             if (Double.TryParse(textEkran.Text, out temp))
             {
                 CalcValue = CalcValue + temp;
             }
         }
         else if (labelTemp.Text.EndsWith("-"))
         {
             if (Double.TryParse(textEkran.Text, out temp))
             {
                 CalcValue = CalcValue - temp;
             }
         }
         else if (labelTemp.Text.EndsWith("*"))
         {
             if (Double.TryParse(textEkran.Text, out temp))
             {
                 CalcValue = CalcValue * temp;
             }
         }
         else if (labelTemp.Text.EndsWith("/") && textEkran.Text != "0" && textEkran.Text != "0." && textEkran.Text != "-0." && textEkran.Text != "-0" && textEkran.Text != "-")
         {
             if (Double.TryParse(textEkran.Text, out temp))
             {
                 CalcValue = CalcValue / temp;
             }
         }
         else if (textEkran.Text == "0" || textEkran.Text == "0." || textEkran.Text == "-0." || textEkran.Text == "-0" || textEkran.Text == "-")
         {
             labelTemp.Text = "Division by zero!";
         }
     }
     textEkran.Text = CalcValue.ToString();
     if (labelTemp.Text != "Division by zero!")
     {
         labelTemp.Text = String.Empty;
     }
 }