/* * 添加按钮点击事件函数 */ private void addBtn_Click(object sender, EventArgs e) { ClientInformationDetailForm addClient = new ClientInformationDetailForm(0); DialogResult rst = addClient.ShowDialog(this); if (rst == DialogResult.OK) { fillClientList(); } }
/* * 双击列表一行显示详细信息 */ private void clientList_DoubleClick(object sender, EventArgs e) { int currentIndex = this.clientList.CurrentRow.Index; DataGridViewRow currentRow = this.clientList.Rows[currentIndex]; ClientInformationDetailForm clientDetail = new ClientInformationDetailForm(4); clientDetail.setTextBoxValue(int.Parse(currentRow.Cells[0].Value.ToString())); clientDetail.setTextBoxDisabled(); clientDetail.ShowDialog(this); }
/* * 编辑按钮点击事件函数 */ private void editBtn_Click(object sender, EventArgs e) { if (this.clientList.Rows.Count <= 0) { MessageBox.Show(this, "当前表内容为空,无法编辑!", "编辑客户提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //表格最多只能选择一行 int currentIndex = this.clientList.CurrentRow.Index; DataGridViewRow currentRow = this.clientList.Rows[currentIndex]; ClientInformationDetailForm clientDetail = new ClientInformationDetailForm(1); clientDetail.setTextBoxValue(int.Parse(currentRow.Cells[0].Value.ToString())); clientDetail.ShowDialog(this); fillClientList(); }
/* * 查询按钮点击事件函数 */ private void searchBtn_Click(object sender, EventArgs e) { ClientInformationDetailForm clientDetail = new ClientInformationDetailForm(2); clientDetail.setParentWindow(this); clientDetail.Show(); }