private void toolStripButtonEDIT_Click(object sender, EventArgs e) { object[] oT = new object[dataGridViewDJMX.ColumnCount]; if (dataGridViewDJMX.SelectedRows.Count < 1) { MessageBox.Show("请选择要修改的商品", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } dSet.Tables["商品表1"].Clear(); DataTable dt = dSet.Tables["商品表1"]; for (int i = dataGridViewDJMX.SelectedRows.Count - 1; i >= 0; i--) { for (int j = 0; j < oT.Length; j++) { oT[j] = dataGridViewDJMX.SelectedRows[i].Cells[j].Value; } dt.Rows.Add(oT); } FormSPDAWH_CARD frmSPDAWH_CARD = new FormSPDAWH_CARD(); frmSPDAWH_CARD.strConn = strConn; frmSPDAWH_CARD.dt = dt; frmSPDAWH_CARD.iStyle = 1; frmSPDAWH_CARD.ShowDialog(); initDataView(frmSPDAWH_CARD.iSelect); }
private void ToolStripButtonADD_Click(object sender, EventArgs e) { if (iVersion <= 0) { if (dataGridViewDJMX.RowCount >= 10) { MessageBox.Show("预览版最多可以管理10种商品"); return; } } dSet.Tables["商品表1"].Clear(); DataTable dt = dSet.Tables["商品表1"]; FormSPDAWH_CARD frmSPDAWH_CARD = new FormSPDAWH_CARD(); frmSPDAWH_CARD.strConn = strConn; //frmSPDAWH_CARD.dt = dt; frmSPDAWH_CARD.iStyle = 0; frmSPDAWH_CARD.ShowDialog(); initDataView(frmSPDAWH_CARD.iSelect); }