private void Compute_Score(object sender, EventArgs e)
        {
            TextBox t = (TextBox)sender;

            try
            {
                int index = Convert.ToInt32(t.Name.Split(new char[] { '_' })[1]);

                Scoring_struct s           = scores[index - 1];
                double         score1      = Convert.ToDouble(t.Text);
                double         percentage1 = percentset[index - 1];
                Label          l           = s.judgeAverageScore;
                scoring.Insert(index - 1, score1.ToString());
                string percent1 = Convert.ToString(percentage1);
                string new1     = "";
                if (percent1.Length == 2)
                {
                    new1 = "." + percentage1;
                }

                else if (percent1.Length == 1)
                {
                    new1 = ".0" + percentage1;
                }
                double final1 = score1 * Convert.ToDouble(new1);
                if (final1 <= percentage1)
                {
                    l.Text = final1.ToString();
                    s.judgeAverageScore.Text = l.Text;
                    averagescore.Insert(index - 1, l.Text);
                }
                else
                {
                    l.Text = "0";
                    t.Text = "0";
                }
            }
            catch (Exception ex)
            {
                //t.Text = "0";
                //MessageBox.Show(ex.ToString());
            }
        }
        public void GenerateObjects()
        {
            DataTable dt = new DataTable();

            dt.Clear();
            adapt = new MySqlDataAdapter("SELECT * FROM tbl_criteria ORDER BY criteria_percentage DESC ", OpenConnection());
            CloseConnection();
            adapt.Fill(dt);
            int counter = 1;

            foreach (DataRow row in dt.Rows)
            {
                Scoring_struct structscore = new Scoring_struct();

                criteriaset.Add(Convert.ToInt32(row["criteria_id"]));
                percentset.Add(Convert.ToInt32(row["criteria_percentage"]));

                panel1.Controls.Add(GenerateLabel1("criteriname_" + counter, row["criteria_name"].ToString(), paddingx + 5, paddingy + 10));

                Label label = GenerateLabel1("average_" + counter, "0", 700, paddingy + 10);

                TextBox textbox = GenerateTextbox("textbox_" + counter, "0", 390, paddingy + 10);
                textbox.KeyPress += new KeyPressEventHandler(CheckScore);

                panel1.Controls.Add(GenerateLabel("percentage_" + counter, row["criteria_percentage"].ToString() + " %", paddingx + 70, paddingy + 10));


                panel1.Controls.Add(textbox);
                panel1.Controls.Add(label);
                paddingy += padding + 65;

                structscore.judgeAverageScore = label;
                scores.Add(structscore);
                counter++;
            }
        }