private void meetingRoomDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { // データがなければ中断 if (e.RowIndex < 0) { return; } // クリックした列が[変更]ボタンでなければ中断 if (e.ColumnIndex != 2 && e.ColumnIndex != 3) { return; } // 対象会議室データを取得 var meetingRoom = meetingRoomBindingSource.Current as MeetingRoom; var editMode = e.ColumnIndex == 2 ? EditMode.Modify : EditMode.Delete; using (var form = new MeetingRoomDetailForm(editMode, meetingRoom)) { var dialogResult = form.ShowDialog(); if ( dialogResult == DialogResult.OK && model.MeetingRooms.Any() ) { // 検索データがあれば再検索 Search(); } } }
private void addNewButton_Click(object sender, EventArgs e) { using (var form = new MeetingRoomDetailForm(EditMode.AddNew)) { var dialogResult = form.ShowDialog(); } }
private void addNewButton_Click(object sender, EventArgs e) { using (var form = new MeetingRoomDetailForm(EditMode.AddNew)) { var dialogResult = form.ShowDialog(); if ( dialogResult == DialogResult.OK && model.MeetingRooms.Any() ) { // 検索データがあれば再検索 Search(); } } }