//新增 private void btnInsert_Click(object sender, EventArgs e) { BehaviorForm editor = new BehaviorForm(this.PrimaryKey, _Editable); if (editor.ShowDialog() == DialogResult.OK) { LoadingData(); } }
//修改 private void listView_MouseDoubleClick(object sender, MouseEventArgs e) { if (listView.SelectedItems.Count == 1) { BehaviorForm editor = new BehaviorForm(listView.SelectedItems[0].Tag as BehaviorRecord, _Editable); if (editor.ShowDialog() == DialogResult.OK) { LoadingData(); } } }
private void btnUpdate_Click(object sender, EventArgs e) { if (listView.SelectedItems.Count == 0) { MsgBox.Show("請先選擇一筆您要修改的資料"); return; } else if (listView.SelectedItems.Count > 1) { MsgBox.Show("選擇資料筆數過多,一次只能修改一筆資料"); return; } if (listView.SelectedItems.Count == 1) { BehaviorForm editor = new BehaviorForm(listView.SelectedItems[0].Tag as BehaviorRecord, _Editable); if (editor.ShowDialog() == DialogResult.OK) { LoadingData(); } } }