private void btnBankaSil_Click(object sender, EventArgs e) { if (hesapSource.Count > 0) { List <HesapBilgileri> silinecekListe = new List <HesapBilgileri>(); foreach (var item in gridViewBanka.GetSelectedRows()) { silinecekListe.Add((HesapBilgileri)gridViewBanka.GetRow(item)); } foreach (var item in silinecekListe) { hesapSource.Remove(item); } } }
BindingSource myListSrc; //検索履歴用Listデータセット public MyList() { InitializeComponent(); myListSrc = new BindingSource(); //ダミーデータをいったん入れて削除しておく PathData dummy = new PathData(); dummy.Value = ""; dummy.WideValue = ""; myListSrc.DataSource = dummy; listBox_myList.DataSource = myListSrc; //データソースを先に設定しないとValueMem listBox_myList.ValueMember = "value"; listBox_myList.DisplayMember = "wideValue"; myListSrc.Remove(dummy); }
private void LoanOutput_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { if (LoanOutput.Columns[e.ColumnIndex].Name == "LoanDelete" && e.RowIndex > -1) { StatusLabel.Text = ""; short movieId = short.Parse(LoanOutput.Rows[e.RowIndex].Cells["LoanVideoCode"].Value.ToString()); foreach (Movie m in loanOutput) { if (m.VideoCode == movieId) { loanOutput.Remove(m); break; } } } }
private void btnKonuSil_Click(object sender, EventArgs e) { if (konuSource.Count > 0) { List <DavaKonusu> silinecekListe = new List <DavaKonusu>(); foreach (var item in gridViewDavaKonu.GetSelectedRows()) { silinecekListe.Add((DavaKonusu)gridViewDavaKonu.GetRow(item)); } foreach (var item in silinecekListe) { konuSource.Remove(item); davaKonuDB.HardDelete(item); } } }
private void DeleteLibrary_Button_Click(object sender, EventArgs e) { string name = Libraries_ListBox.SelectedItem.ToString(); if (MessageBox.Show($"确定要移除 Library: {name} 吗 (≧﹏ ≦)", "移除 Library", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { __libraryListBox_BindingSource.Remove(name); foreach (var key in __deleteKey_List) { if (key.GetSubKeyNames().Contains(name)) { key.DeleteSubKey(name); } } MessageBox.Show($"移除 Library {name} 成功 ヾ(≧▽≦*)o", "移除 Library", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btRemove_Click(object sender, EventArgs e) { dtp_.Visible = false; DateRangeSetting setting = (DateRangeSetting)nameListBox_.SelectedItem; if (setting == null) { return; } if (DialogResult.Yes != MessageBox.Show("Are you sure to remove ?", "Selector", MessageBoxButtons.YesNo)) { return; } DB.Global().Execute(String.Format("Delete From daterange_setting Where name = '{0}'", setting.name_)); BindingSource bs = (BindingSource)(nameListBox_.DataSource); bs.Remove(setting); }
private void btnTurSil_Click(object sender, EventArgs e) { if (davaTuruSource.Count > 0) { List <DavaTuru> silinecekListe = new List <DavaTuru>(); foreach (var item in gridViewDavaTur.GetSelectedRows()) { silinecekListe.Add((DavaTuru)gridViewDavaTur.GetRow(item)); } foreach (var item in silinecekListe) { davaTuruDB.Delete(item); davaTuruSource.Remove(item); } } }
public static void MoveDown(this BindingSource aBindingSource) { int position = aBindingSource.Position; if (position == aBindingSource.Count - 1) { return; // already at bottom } aBindingSource.RaiseListChangedEvents = false; object current = aBindingSource.Current; aBindingSource.Remove(current); position++; aBindingSource.Insert(position, current); aBindingSource.Position = position; aBindingSource.RaiseListChangedEvents = true; aBindingSource.ResetBindings(false); }
// REMOVER MENSAGEM //------------------------------------------------------------------------------------------------------------ private void RemoverMensagem() { if (dgvListagem.SelectedRows.Count == 0) { AbrirDialog("Selecione um registro para Remover...", "Selecionar"); return; } //--- get selected message objMensagem mensagem = (objMensagem)dgvListagem.SelectedRows[0].DataBoundItem; //--- ask user var resp = AbrirDialog("Você deseja realmente REMOVER a mensagem selecionada para o usuário\n" + $"{mensagem.UsuarioDestino.ToUpper()}?", "Remover Mensagem", DialogType.SIM_NAO, DialogIcon.Question, DialogDefaultButton.Second); if (resp != DialogResult.Yes) { return; } try { // --- Ampulheta ON Cursor.Current = Cursors.WaitCursor; //--- remove mBLL.DeleteMensagem((int)mensagem.IDMensagem); //--- get dados bind.Remove(mensagem); } catch (Exception ex) { AbrirDialog("Uma exceção ocorreu ao Salvar Mensagem..." + "\n" + ex.Message, "Exceção", DialogType.OK, DialogIcon.Exclamation); } finally { // --- Ampulheta OFF Cursor.Current = Cursors.Default; } }
public void clbOrderNumbers_ItemCheck(object sender, ItemCheckEventArgs e) { PurchaseOrdersObj purchaseorder = PurchaseOrders.GetByID((int)clbOrderNumbers.Items[e.Index]); if (e.NewValue == CheckState.Checked) { foreach (PurchaseOrderDetailsObj item in PurchaseOrderDetails.GetByPONumber(purchaseorder.PONumber).FindAll(m => m.QuantityRemaining != 0)) { bs.Add(item); } } else { foreach (PurchaseOrderDetailsObj item in purchaseorderdetailslist.FindAll(m => m.PONumber == purchaseorder.PONumber)) { bs.Remove(item); } } }
private void RemoveSelectedSites( ) { _isModified = true; ArrayList removeList = new ArrayList(); foreach (DataGridViewRow row in grd.SelectedRows) { if (row.DataBoundItem == null) { continue; } removeList.Add(row.DataBoundItem); } foreach (object site in removeList) { _bs.Remove(site); } }
private void listView1_DragDrop(object sender, DragEventArgs e) { if (e.Effect == DragDropEffects.Move) { Person person = (Person)e.Data.GetData(typeof(Person)); if (person != null) { listView1.Items.Add(person.Name, person.Foto); listView1.Items[listView1.Items.Count - 1].Checked = true; listView1.Items[listView1.Items.Count - 1].Name = person.Name; listView1.Items[listView1.Items.Count - 1].SubItems.Add(person.Name); listView1.Items[listView1.Items.Count - 1].SubItems.Add(person.Surname); listView1.Items[listView1.Items.Count - 1].SubItems.Add(person.Age.ToString()); listView1.Items[listView1.Items.Count - 1].SubItems[0].Text = person.Name; listView1.Items[listView1.Items.Count - 1].SubItems[1].Text = person.Surname; listView1.Items[listView1.Items.Count - 1].SubItems[2].Text = person.Age.ToString(); source.Remove(person); } } }
/* * void refeshGVQLCauHoi() * { * using (var db = new dbQLThiTracNghiemDataContext()) * { * gvQuestions.DataSource = db.Questions.ToList(); * } * } * void refeshGVCauHoiDongGop() * { * using (var db = new dbQLThiTracNghiemDataContext()) * { * gvContributeQuestions.DataSource = db.QuestionRequests.ToList(); * } * } * void refeshGVDeThi() * { * using (var db = new dbQLThiTracNghiemDataContext()) * { * gvTests.DataSource = db.Tests.ToList(); * } * } */ // //================================Tab Quan Ly Cau Hoi Dong Gop================================ // private void XoaCauHoiDongGop_Click(object sender, EventArgs e) { if (gvContributeQuestions.SelectedRows.Count > 0) { using (var db = new dbQLThiTracNghiemDataContext()) { for (int i = 0; i < gvContributeQuestions.SelectedRows.Count; i++) { QuestionRequest qs = (QuestionRequest)gvContributeQuestions.SelectedRows[i].DataBoundItem; db.QuestionRequests.Attach(qs); db.QuestionRequests.DeleteOnSubmit(qs); bs.Remove(qs); } db.SubmitChanges(); } //refeshGVCauHoiDongGop(); } else { MessageBox.Show("Chọn ít nhất 1 dòng để xóa!"); } }
public void EliminarItem() { var it = (OOB.LibSistema.UsuarioGrupo.Ficha)bsLista.Current; if (it != null) { var msg = "ESTAS SEGURO DE ELIMINAR ESTE GRUPO ?"; var res = MessageBox.Show(msg, "*** ALERTA ***", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (res == DialogResult.Yes) { var r01 = Sistema.MyData.GrupoUsuario_ELiminar(it.auto); if (r01.Result == OOB.Enumerados.EnumResult.isError) { Helpers.Msg.Error(r01.Mensaje); return; } bsLista.Remove(it); } } }
private void mnuItemDesvincular_Click(object sender, EventArgs e) { //--- verifica se existe alguma cell if (dgvListagem.SelectedRows.Count == 0) { return; } //--- Get A Pagar on list objDespesa item = (objDespesa)dgvListagem.SelectedRows[0].DataBoundItem; //--- ask user var resp = AbrirDialog($"Deseja desvincular a despesa realizada: {item.IDDespesa:D4} valor: {item.DespesaValor:c} da despesa Provisória?", "Desvincular", DialogType.SIM_NAO, DialogIcon.Question, DialogDefaultButton.Second); if (resp != DialogResult.Yes) { return; } try { // --- Ampulheta ON Cursor.Current = Cursors.WaitCursor; provBLL.DettachDespesaToProvisoria(_provisoria, item); bindDespesa.Remove(item); _provisoria.EndEdit(); Sit = EnumFlagEstado.RegistroSalvo; } catch (Exception ex) { AbrirDialog("Uma exceção ocorreu ao Desvincular a Despesa..." + "\n" + ex.Message, "Exceção", DialogType.OK, DialogIcon.Exclamation); } finally { // --- Ampulheta OFF Cursor.Current = Cursors.Default; } }
private void numericUpDown2_ValueChanged(object sender, EventArgs e) { int n = Convert.ToInt32(numericUpDown2.Value); if (n > source.Count) { for (int i = source.Count; i < n; i++) { source.Add(new Rabotnik("", "", new decimal[6], new DateTime())); } dataGridView1.DataSource = source; } else if (n < source.Count) { for (int i = source.Count; i > n; i--) { source.Remove(source[i - 1]); } dataGridView1.DataSource = source; } }
private void btnRemove_Click(object sender, EventArgs e) { DataTable dt = (DataTable)straGrid_.DataSource; dt.Rows.Clear(); cmbBox_.Visible = false; SolutionSetting setting = (SolutionSetting)nameListBox_.SelectedItem; if (setting == null) { return; } if (DialogResult.Yes != MessageBox.Show("Are you sure to remove ?", "Selector", MessageBoxButtons.YesNo)) { return; } DB.Global().Execute(String.Format("Delete From solution_setting Where solution = '{0}'", setting.name_)); BindingSource bs = (BindingSource)(nameListBox_.DataSource); bs.Remove(setting); }
private void dataGridEh1_SelectionChanged(object sender, DataGridSelectionChangeOperationEventArgs e) { labelSelInfo.Text = dataGridEh1.Selection.SelectedRowCount.ToString() + " Row(s) selected"; if (e.ChangeOpType == SelectionChangeOperationType.RowSelected) { selectedRows.Add(((EhLib.WinForms.DataGridRow)e.ChangingObject).SourceItem); } else if (e.ChangeOpType == SelectionChangeOperationType.RowDeselected) { selectedRows.Remove(((EhLib.WinForms.DataGridRow)e.ChangingObject).SourceItem); } else { selectedRows.Clear(); foreach (DataGridRow row in dataGridEh1.Selection.SelectedRows) { selectedRows.Add(row.SourceItem); } } }
private void DeleteFromGlobalUom() { if (dgvUnitOfMeasure.CurrentCell.RowIndex != -1 && dgvUnitOfMeasure.CurrentCell.RowIndex < _allUoms.Count) { var uom = _allUoms[dgvUnitOfMeasure.CurrentCell.RowIndex]; string message = "Are you sure you want to delete the selected Uom?"; string caption = "Delete Global Uom"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == DialogResult.Yes) { MessageBox.Show("Please make sure that the Unit of Measure you are deleting is NOT being used as a reference in the BaseUoms List"); if ((_projectUoms.Where(u => u.UomID == (uom.ID))).Count() > 0) { MessageBox.Show("This will also delete the corresponding entry from the Project Units of Measure"); _projectUoms.Remove(uom.ProjectUoms.Single()); AryaTools.Instance.InstanceData.Dc.ProjectUoms.DeleteOnSubmit(uom.ProjectUoms.Single()); } data.Remove(uom); _allUoms.Remove(uom); if (_baseUoms.Contains(uom)) { _baseUoms.Remove(uom); } AryaTools.Instance.InstanceData.Dc.UnitOfMeasures.DeleteOnSubmit(uom); AryaTools.Instance.SaveChangesIfNecessary(false, false); dgvUnitOfMeasure.RowCount = _allUoms.Count + 1; dgvUnitOfMeasure.Invalidate(); } } else { MessageBox.Show("There is no data to delete"); return; } }
private void deleteReportButton_Click(object sender, EventArgs e) { if (gradeReportListBox.SelectedItem != null) { DialogResult dr = MessageBox.Show("Are you sure you want to delete this report?", "Delete Report", MessageBoxButtons.YesNoCancel); if (dr == DialogResult.Yes) { reportsBinding.Remove(classCategoriesContainer.classContainerList[gradeCategoriesListBox.SelectedIndex].gradeReportList[gradeReportListBox.SelectedIndex]); reportsBinding.DataSource = null; reportsBinding.DataSource = classCategoriesContainer.classContainerList[gradeCategoriesListBox.SelectedIndex].gradeReportList; gradeReportListBox.DataSource = reportsBinding; gradeReportListBox.DisplayMember = "Display"; gradeReportListBox.ValueMember = "Display"; gradeReportListBox.SelectedIndex = -1; } } else { MessageBox.Show("Please select a report to delete"); } }
private void deleteCategoryButton_Click(object sender, EventArgs e) { if (gradeCategoriesListBox.SelectedItem != null) { DialogResult dr = MessageBox.Show("Are you sure you want to delete " + classCategoriesContainer.classContainerList[gradeCategoriesListBox.SelectedIndex].categoryName, "Delete Class Confirmation", MessageBoxButtons.YesNoCancel); if (dr != DialogResult.Yes) { return; } categoriesBinding.Remove(gradeCategoriesListBox.SelectedItem); UpdateInformation(sender, e); reportsBinding.DataSource = null; gradeReportListBox.DataSource = reportsBinding; gradeReportListBox.DisplayMember = ""; gradeReportListBox.ValueMember = ""; } else { MessageBox.Show("A class needs to be selected before it can be removed."); } }
public static void GridRowMoveUp(this BindingSource aBindingSource) { int position = aBindingSource.Position; if (position == 0) { return; // already at top } aBindingSource.RaiseListChangedEvents = false; object current = aBindingSource.Current; aBindingSource.Remove(current); position--; aBindingSource.Insert(position, current); aBindingSource.Position = position; aBindingSource.RaiseListChangedEvents = true; aBindingSource.ResetBindings(false); }
private void SubDoAppenSectorEvent(IList <AirComAntennaType> AntennaTypes) { if (this.InvokeRequired) { object[] Params = new object[] { AntennaTypes }; this.Invoke(new Action <IList <AirComAntennaType> >(this.SubDoAppenSectorEvent), Params); return; } try { var _olds = _AllAntennas.Where(fo => fo.Celliid == AntennaTypes[0].Celliid).ToList(); _olds.ForEach(fo => _bindingSource.Remove(fo)); foreach (var obj in AntennaTypes) { _bindingSource.Add(obj); } } catch (Exception ex) { JLog.Instance.Error(ex.Message, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().Module.Name); } }
private void DeleteHirer_Click(object sender, EventArgs e) { // Prompt the user if they're sure about deleting the record var h = (Hirer)Hirers.Current; var message = string.Format("Are you sure you want to delete the following record\n{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}", h.Code, h.Name, h.AddressLn1, h.AddressLn2, h.AddressLn3, h.AddressLn4, h.AddressLn5); var result = MessageBox.Show(message, "Delete record", MessageBoxButtons.YesNo, MessageBoxIcon.Error); // Check the user's response if (result == DialogResult.Yes) { // Temporarily unbind BindingSource from DataGridView DataSource HirerDataGridView.DataSource = null; // Remove the item from the binding source Hirers.Remove(h); // Rebind BindingSource to DataGridView DataSource HirerDataGridView.DataSource = Hirers; // Save the change to file UpdateCsvFile <Hirer>(((SortableBindingList <Hirer>)Hirers.DataSource).ToList(), HirerCsvPath); // Refocus on the Code ComboBox HirerCode.Select(); } }
private void DeletePlant_Click(object sender, EventArgs e) { // Prompt the user if they're sure about deleting the record var m = (Machine)Machines.Current; var message = string.Format("Are you sure you want to delete the following record\n{0}\n{1}\n{2}\n{3}\n{4}\n{5}", m.Code, m.DetailLn1, m.DetailLn2, m.DetailLn3, m.DetailLn4, m.DetailLn5); var result = MessageBox.Show(message, "Delete record", MessageBoxButtons.YesNo, MessageBoxIcon.Error); // Check the user's response if (result == DialogResult.Yes) { // Temporarily unbind BindingSource from DataGridView DataSource MachineDataGridView.DataSource = null; // Remove the item from the binding source Machines.Remove(m); // Rebind BindinSgource to DataGridView DataSource MachineDataGridView.DataSource = Machines; // Save the change to file UpdateCsvFile <Machine>(((SortableBindingList <Machine>)Machines.DataSource).ToList(), PlantCsvPath); // Refocus on the Code ComboBox PlantCode.Select(); } }
/// <summary> /// removeClassbutton, deletes the currently selected item in the listBox or displays a messageBox if nothing is selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void removeClassButton_Click(object sender, EventArgs e) { //If there is something selected in the ListBox then if (classesListBox.SelectedItem != null) { //Display a messagebox DialogResult dr = MessageBox.Show("Are you sure you want to delete " + classContainer.classCategoriesContainer[classesListBox.SelectedIndex].className, "Delete Class Confirmation", MessageBoxButtons.YesNoCancel); // If the result of the message box is not yes, return. if (dr != DialogResult.Yes) { return; } //Otherwise remove the item and update the changes classesBinding.Remove(classesListBox.SelectedItem); classContainer_AcceptedChanges(sender, e); } //Otherwise show a message box else { MessageBox.Show("A class needs to be selected before it can be removed."); } }
private void OnTrade(object sender, TradeArgs e) { var t = (Trade)sender; this.Invoke(new Action(() => { _bsTrade.Add(e.Value); var dirPosi = e.Value.Direction; if (e.Value.Offset != OffsetType.Open) { dirPosi = dirPosi == DirectionType.Buy ? DirectionType.Sell : DirectionType.Buy; } var posi = _t.DicPositionField[e.Value.InstrumentID + "_" + dirPosi]; if (_bsPosi.IndexOf(posi) < 0) //持仓0过滤 { _bsPosi.Add(posi); } if (posi.Position <= 0) //条件:Position>0 { _bsPosi.Remove(posi); } //测试一下:filterBindingList只在增减时才会执行 //if (_bsPosi.IndexOf(posi) < 0) // _bsPosi.Add(posi); //var list = _bsPosi.DataSource as SortableBindingList<PositionField>; //var p = list.FirstOrDefault(n => n.InstrumentID == e.Value.InstrumentID && n.Direction == dirPosi); //if (p == null) // _bsPosi.Add(_t.DicPositionField[e.Value.InstrumentID + "_" + dirPosi]); //else if (p.Position == 0) // _bsPosi.Remove(p); })); }
private void btnRemoverItem_Click(object sender, EventArgs e) { //--- check selected item if (dgvListagem.SelectedRows.Count == 0) { AbrirDialog("Favor selecionar um registro para REMOVER...", "Selecionar Registro", DialogType.OK, DialogIcon.Information); return; } //--- get Selected item objAPagar item = (objAPagar)dgvListagem.SelectedRows[0].DataBoundItem; try { // --- Ampulheta ON Cursor.Current = Cursors.WaitCursor; //--- Update DB despBLL.RemoverVinculoAPagarItem((long)item.IDAPagar); //--- Remove to list bindAPagar.Remove(item); bindAPagar.ResetBindings(false); } catch (Exception ex) { AbrirDialog("Uma exceção ocorreu ao Excluir registro de APagar..." + "\n" + ex.Message, "Exceção", DialogType.OK, DialogIcon.Exclamation); } finally { // --- Ampulheta OFF Cursor.Current = Cursors.Default; } }
private void listBox_recent_KeyDown(object sender, KeyEventArgs e) { //Deleteで選択中の項目削除 if (e.KeyCode == Keys.Delete) { int count = listBox_myList.SelectedItems.Count; listBox_myList.BeginUpdate(); for (int i = 0; i < count; i++) { PathData p = (PathData)listBox_myList.SelectedItem; myListSrc.Remove(p); } listBox_myList.EndUpdate(); } //Ctrl+Aで全選択 if (e.KeyCode == Keys.A && e.Control) { for (int i = 0; i < listBox_myList.Items.Count; i++) { listBox_myList.SetSelected(i, true); } } }
private void lbRemoveCondition_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { orderBindingSource.Remove(selectedCondition); }