private void Copy_goods() { try { Name_t.Clear(); Ed_t.Clear(); Price_t.Clear(); Count_t.Clear(); comboBox2.ResetText(); string k = comboBox1.Text; int index = Convert.ToInt32(k); string s1 = dataGridView1.Rows[index - 1].Cells[1].Value.ToString(); string s2 = dataGridView1.Rows[index - 1].Cells[2].Value.ToString(); string s3 = dataGridView1.Rows[index - 1].Cells[3].Value.ToString(); string s4 = dataGridView1.Rows[index - 1].Cells[4].Value.ToString(); string s5 = dataGridView1.Rows[index - 1].Cells[5].Value.ToString(); Name_t.Text = s1; comboBox2.Text = s2; Ed_t.Text = s3; Price_t.Text = s4; Count_t.Text = s5; } catch (Exception) { } }
// ----------------------------------------------------------------------------- // probability computation static int CalcProba(Count_t num, Count_t total, int max_proba, int round) { int p; Global.assert(total > 0); p = (int)(((int)num * max_proba + round) / (uint)total); Global.assert(p >= 0 && p <= MAX_PROBA); return MAX_PROBA - p; }