/// <summary> /// 将左边的数据填充到row中 /// </summary> /// <param name="dr"></param> private void AddToRow(DataRow dr, MData data) { dr[1] = data.Name; dr[2] = data.Unit; dr[3] = data.Stand; dr[4] = data.SellNum; dr[5] = data.PriOne; dr[6] = data.AllPrice; dr[7] = data.AllMoney; dr[8] = data.Note; }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { if (dataGridView1.CurrentRow.Index < 0) { return; } int id = dataGridView1.CurrentRow.Index; MData md = list[id]; ShowData(md); }
private void ShowData(MData md) { txt_RId.Text = md.Id.ToString(); txt_SName.Text = md.Name.ToString(); txt_Sunit.Text = md.Unit.ToString(); txt_Sstand.Text = md.Stand.ToString(); txt_SAllNum.Text = md.SAllNum.ToString(); txt_SSellNum.Text = md.SellNum.ToString(); txt_SPriOne.Text = md.PriOne.ToString(); txt_SAllPrice.Text = md.AllPrice.ToString(); txt_SAllMoney.Text = md.AllMoney.ToString(); txt_SNote.Text = md.Note.ToString(); }
private void btn_Add_Click(object sender, EventArgs e) { if (MessageBox.Show("确定添加?", "确认", MessageBoxButtons.OKCancel) == DialogResult.OK) { ConIsChange(); MData data = GetData(); DataRow dr = table.NewRow(); list.Add(data); AddListToTable(); dataGridView1.DataSource = table; ChangeAllMoney(); } }