private void btnAdd_Click(object sender, EventArgs e) { NewZT frmnewzt = new NewZT(); if (frmnewzt.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bind(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show(string.Format("请选择要编辑的数据"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow datarow = dataGridView1.SelectedRows[0]; string name = (datarow.Cells["name"].Value == null ? "" : datarow.Cells["name"].Value.ToString()); string des = (datarow.Cells["des"].Value == null ? "" : datarow.Cells["des"].Value.ToString()); string type = (datarow.Cells["type"].Value == null ? "CPRS" : datarow.Cells["type"].Value.ToString()); NewZT frm = new NewZT(datarow.Cells["Id"].Value.ToString(), name, des, type); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bind(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show(string.Format("请选择要编辑的数据"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow datarow = dataGridView1.SelectedRows[0]; string name = (datarow.Cells["name"].Value == null ? "" : datarow.Cells["name"].Value.ToString()); string des = (datarow.Cells["des"].Value == null ? "" : datarow.Cells["des"].Value.ToString()); string type = (datarow.Cells["type"].Value == null ? "CPRS" : datarow.Cells["type"].Value.ToString()); NewZT frm = new NewZT(datarow.Cells["id"].Value.ToString(), name, des, type); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bind(); } }