private void GVHeaderB_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { }
private void DBGrid_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { rowChanged = true; StatusLabel4.Text = ""; }
private void dataGridViewPlaces_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { _rowPlaces = dataGridViewPlaces.SelectedCells[0].RowIndex; _cellPlaces = dataGridViewPlaces.SelectedCells[0].ColumnIndex; }
private void dgvDetallesCompra_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { cantidad = Convert.ToInt32(dgvDetallesCompra.CurrentRow.Cells["Cantidad"].Value.ToString()); }
private void tableDataGrid_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { dirty = true; }
// User selects a cell for editing private void fieldslist_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { // Field name cell? if (e.ColumnIndex == 0) { // New row index? if (e.RowIndex == fieldslist.NewRowIndex) { // Remove all text fieldslist.Rows[e.RowIndex].Cells[0].Style.ForeColor = SystemColors.WindowText; if (autoinsertuserprefix) { fieldslist.Rows[e.RowIndex].Cells[0].Value = FIELD_PREFIX_SUGGESTION; } else { fieldslist.Rows[e.RowIndex].Cells[0].Value = ""; } } } // Value cell? else if (e.ColumnIndex == 2) { // Get the row FieldsEditorRow frow = null; DataGridViewRow row = fieldslist.Rows[e.RowIndex]; if (row is FieldsEditorRow) { // Get specializedrow frow = row as FieldsEditorRow; // Enumerable? if (frow.TypeHandler.IsEnumerable) { // Fill combo with enums enumscombo.SelectedItem = null; enumscombo.Text = ""; enumscombo.Items.Clear(); enumscombo.Items.AddRange(frow.TypeHandler.GetEnumList().ToArray()); enumscombo.Tag = frow; // Lock combo to enums? if (frow.TypeHandler.IsLimitedToEnums) { enumscombo.DropDownStyle = ComboBoxStyle.DropDownList; } else { enumscombo.DropDownStyle = ComboBoxStyle.DropDown; } // Position combobox Rectangle cellrect = fieldslist.GetCellDisplayRectangle(2, row.Index, false); enumscombo.Location = new Point(cellrect.Left, cellrect.Top); enumscombo.Width = cellrect.Width; int internalheight = cellrect.Height - (enumscombo.Height - enumscombo.ClientRectangle.Height) - 6; General.SendMessage(enumscombo.Handle, General.CB_SETITEMHEIGHT, -1, internalheight); // Select the value of this field (for DropDownList style combo) foreach (EnumItem i in enumscombo.Items) { // Matches? if (string.Compare(i.Title, frow.TypeHandler.GetStringValue(), true, CultureInfo.InvariantCulture) == 0) { // Select this item enumscombo.SelectedItem = i; } } // Put the display text in the text (for DropDown style combo) enumscombo.Text = frow.TypeHandler.GetStringValue(); // Show combo enumscombo.Show(); } } } }
//DGV private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { this.panel1.BackColor = Color.Red; }
// Evento disparado cuando se comienza a editar una celda private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { currentStateEditing = myStates[e.RowIndex]; }
public PhysicalAbilityValidator(object sender, DataGridViewCellCancelEventArgs ee) : base(sender, ee) { //Validate(); }
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (e.ColumnIndex == dataGridView1.Columns["品號"].Index && dataGridView1.CurrentRow.IsNewRow) { ProductSelect fm = new ProductSelect(); DataRow dr; fm.ShowDialog(); try { dataGridView1.AllowUserToAddRows = false; scheduleBs.AddNew(); dataGridView1[e.ColumnIndex, e.RowIndex].Value = irow; dr = myds.Tables["產品資料表"].Rows.Find(dataGridView1["品號", e.RowIndex].Value.ToString()); dataGridView1["品名", e.RowIndex].Value = dr["品名"]; dataGridView1["規格", e.RowIndex].Value = dr["規格"]; dataGridView1["單價", e.RowIndex].Value = dr["單價"]; dataGridView1["目前庫存數量", e.RowIndex].Value = dr["庫存量"].ToString(); dataGridView1.AllowUserToAddRows = true; dataGridView1.CurrentCell = dataGridView1[dataGridView1.Columns["數量"].Index, e.RowIndex]; _irow = new int(); } catch { dataGridView1.Rows.RemoveAt(e.RowIndex); dataGridView1.AllowUserToAddRows = true; } } else if (e.ColumnIndex == dataGridView1.Columns["品號"].Index) { ProductSelect fm = new ProductSelect(); fm.ShowDialog(); //dataGridView1.AllowUserToAddRows = false; if (!dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString().Equals(_irow.ToString())) { DataRow dr = myds.Tables["訂單明細資料表"].NewRow(); int old; int old2; try { old = int.Parse(myds.Tables["訂單明細資料表"].Rows[e.RowIndex]["品號"].ToString()); } catch { old = 0; } try { old2 = int.Parse(myds.Tables["訂單明細資料表"].Rows[e.RowIndex]["數量"].ToString()); } catch { old2 = 0; } dr["品號"] = _irow; myds.Tables["訂單明細資料表"].Rows.Add(dr); try { dataGridView1.Rows.Remove(dataGridView1.CurrentRow); dr = myds.Tables["產品資料表"].Rows.Find(dataGridView1["品號", e.RowIndex].Value.ToString()); dataGridView1["品名", e.RowIndex].Value = dr["品名"]; dataGridView1["規格", e.RowIndex].Value = dr["規格"]; dataGridView1["單價", e.RowIndex].Value = dr["單價"]; dataGridView1["目前庫存數量", e.RowIndex].Value = dr["庫存量"].ToString(); _irow = new int(); } catch { dr = myds.Tables["訂單明細資料表"].NewRow(); dr["品號"] = old; myds.Tables["訂單明細資料表"].Rows.Add(dr); dataGridView1.Rows.Remove(dataGridView1.CurrentRow); dr = myds.Tables["產品資料表"].Rows.Find(dataGridView1["品號", e.RowIndex].Value.ToString()); if (old2 != 0) { dataGridView1["數量", e.RowIndex].Value = old2; } try { dataGridView1["品名", e.RowIndex].Value = dr["品名"]; dataGridView1["規格", e.RowIndex].Value = dr["規格"]; dataGridView1["單價", e.RowIndex].Value = dr["單價"]; dataGridView1["目前庫存數量", e.RowIndex].Value = dr["庫存量"].ToString(); } catch { } _irow = new int(); } } } }
private void dgv_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { oldkey = "" + dgv.Rows[e.RowIndex].Cells["key"].Value; }
private void dataGridView2_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { //DataGridView dgv = (DataGridView)sender; //MessageBox.Show(e.RowIndex.ToString() + dgv.Columns[e.ColumnIndex].Name); }
public bool PushValue(int boundColumnIndex, int columnIndex, int rowIndex, object value) { try { if (value != null) { System.Type c = value.GetType(); System.Type valueType = this.owner.Columns[columnIndex].ValueType; if (!valueType.IsAssignableFrom(c)) { TypeConverter converter = this.BoundColumnConverter(boundColumnIndex); if ((converter != null) && converter.CanConvertFrom(c)) { value = converter.ConvertFrom(value); } else { TypeConverter cachedTypeConverter = this.owner.GetCachedTypeConverter(c); if ((cachedTypeConverter != null) && cachedTypeConverter.CanConvertTo(valueType)) { value = cachedTypeConverter.ConvertTo(value, valueType); } } } } this.props[boundColumnIndex].SetValue(this.currencyManager[rowIndex], value); } catch (Exception exception) { if (System.Windows.Forms.ClientUtils.IsCriticalException(exception)) { throw; } DataGridViewCellCancelEventArgs e = new DataGridViewCellCancelEventArgs(columnIndex, rowIndex); this.ProcessException(exception, e, false); return !e.Cancel; } return true; }
public void ProcessException(Exception exception, DataGridViewCellCancelEventArgs e, bool beginEdit) { DataGridViewDataErrorEventArgs args = new DataGridViewDataErrorEventArgs(exception, e.ColumnIndex, e.RowIndex, DataGridViewDataErrorContexts.Commit); this.owner.OnDataErrorInternal(args); if (args.ThrowException) { throw args.Exception; } if (args.Cancel) { e.Cancel = true; if (beginEdit) { IEditableObject current = this.currencyManager.Current as IEditableObject; if (current != null) { current.BeginEdit(); } } } else { this.CancelRowEdit(false, false); } }
// Before editing the cell value, the original value is recorded. void rasterGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { oldValue = Convert.ToDouble(rasterGridView[e.ColumnIndex, e.RowIndex].Value); }
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { objTemp = dataGridView1.CurrentCell.Value; }
internal void OnRowValidating(DataGridViewCellCancelEventArgs e) { if (this.currencyManager.ShouldBind) { if (!this.dataConnectionState[4] && !this.owner.IsCurrentRowDirty) { if (!this.dataConnectionState[0x40]) { this.dataConnectionState[8] = true; try { this.CancelRowEdit(false, false); } finally { this.dataConnectionState[8] = false; } } } else if (this.owner.IsCurrentRowDirty) { this.dataConnectionState[0x100] = true; try { this.currencyManager.EndCurrentEdit(); } catch (Exception exception) { if (System.Windows.Forms.ClientUtils.IsCriticalException(exception)) { throw; } this.ProcessException(exception, e, true); } finally { this.dataConnectionState[0x100] = false; } } this.dataConnectionState[4] = true; } }
private void dgvSkaters_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { UpdateRowStorage(e.RowIndex, false); }
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { //MessageBox.Show("开始编辑"); }
private void dgvProductCategory_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { try { if (!dgvProductCategory.IsCurrentRowDirty) { return; } if (dgvProductCategory.CurrentRow.Cells["ProductCategoryCode"].Value != null) { SqlString productCategoryCode = dgvProductCategory.CurrentRow.Cells["ProductCategoryCode"].Value.ToString(); if (productCategoryCode.IsNull) { dgvProductCategory.Rows[e.RowIndex].ErrorText = "Product Category Code is required"; e.Cancel = true; return; } var rx = new System.Text.RegularExpressions.Regex(@"^\d{2}$"); if (!rx.IsMatch(productCategoryCode.Value)) { dgvProductCategory.Rows[e.RowIndex].ErrorText = "Please enter Product Category Code in ##"; e.Cancel = true; return; } ProductCategory productCategory = null; // new record if (e.RowIndex >= _productCategoryCollection.Count) { var checkProductCategoryCollection = new ProductCategory.ParameteredCollection(productCategoryCode, SqlString.Null); checkProductCategoryCollection.Load(); if (checkProductCategoryCollection.Count > 0) { dgvProductCategory.Rows[e.RowIndex].ErrorText = "Product Category already exists"; e.Cancel = true; } else { productCategory = _productCategoryCollection.Create(new ProductCategoryKey(productCategoryCode)); if (dgvProductCategory.CurrentRow.Cells["ProductCategoryDescription"].Value != null) { productCategory.ProductCategoryDescription = (SqlString)(dgvProductCategory.CurrentRow.Cells["ProductCategoryDescription"].Value); } _productCategoryCollection.Save(productCategory); // when the initial collection is empty // 1. productCategory in bindingSource is not set to the correct type, so reset the bindingSource.DataSource below // 2. the data moves above need to check for null if (bindingSourceProductCategory.Count == 1) { bindingSourceProductCategory.DataSource = null; bindingSourceProductCategory.DataSource = _productCategoryCollection; } else { bindingSourceProductCategory.List[bindingSourceProductCategory.Count - 1] = productCategory; } } } // existing record else { //productCategory = _productCategoryCollection[new ProductCategoryKey(productCategoryCode)]; //productCategory.Save(); productCategory = (ProductCategory)dgvProductCategory.CurrentRow.DataBoundItem; _productCategoryCollection.Save(productCategory); _productCategoryCollection[new ProductCategoryKey(productCategoryCode)] = productCategory; } } } catch (Exception ex) { Utility.GetInstance().HandleException(this, ex, e); } }
public RiskManagementValidator(object sender, DataGridViewCellCancelEventArgs ee) : base(sender, ee) { //Validate(); }
private void dgvEditing_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { editingValue = dgvEditing.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); }
private void dgvSubject_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { subjuctid = Convert.ToInt32(dgvSubject.SelectedRows[0].Cells["ID"].Value); subname = Convert.ToString(dgvSubject.SelectedRows[0].Cells["SubjectName"].Value); }
private void dgvYj_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { UI.Input_CJ.InputMain.tsmiCut.Enabled = true; UI.Input_CJ.InputMain.tsmiPaste.Enabled = true; }
private void DataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { this.dataGridView1[e.ColumnIndex, e.RowIndex].Value = this.engine.Sheet[e.RowIndex, e.ColumnIndex].Text; }
/*void _Grid_CellClick(object sender, DataGridViewCellEventArgs e) * { * try * { * bool attributefound = false; * //get the sinle selected object * T obj = _inputlist[e.RowIndex]; * //get the selected propertyname from the column * string propname = ((DataGridView)sender).Columns[e.ColumnIndex].DataPropertyName; * //get all properties * PropertyInfo _PropertyInfo = obj.GetType().GetProperties().ToList().Where(x => x.Name == propname).First(); * * foreach (CustomAttributeData attr in _PropertyInfo.CustomAttributes) * { * if (attr.AttributeType == typeof(PropertyGridViewer)) * { * attributefound = true; * if ((bool)attr.NamedArguments.ToList().Where(x => x.MemberName == "ShowInPropertyGrid").First().TypedValue.Value) * { * _BindingListRefresh.StopRefreshing(); * PG_details.SelectedObject = ((DataGridView)sender).CurrentCell.Value; * PG_details.Visible = true; * PG_details.ExpandAllGridItems(); * break; * } * else * { * PG_details.Visible = false; * } * } * } * if (!attributefound) * { * PG_details.SelectedObject = ((DataGridView)sender).CurrentCell.Value; * PG_details.Visible = false; * } * } * catch (Exception ee) * { * logger.Error(this.Name, ee); * } * }*/ #region refresh data private void extendDataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { _BindingListRefresh.StopRefreshing(); }
private void LogsDBView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { promptToSave = true; //User has made an edit, ask to save before closing the database. If this is false, close without prompt }
private void dataGrid_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { dataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = "."; }
private void GVHeader_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { try { Saldo = GetSaldo; if (Saldo <= 0) { if (Start) { DataRow drr = (DataRow)(GVDetailA.SelectedCells[0].OwningRow.DataBoundItem as DataRowView).Row; string NamaKolom = GVDetailA.Columns[e.ColumnIndex].Name.ToString().ToUpper(); // DataRow drr = (DataRow)(GVHeader.Rows[e.RowIndex].DataBoundItem as DataRowView).Row; switch (NamaKolom) { case "OK": { if (Convert.ToBoolean(drr["Ok"]) == true) { drr["RpADJ"] = 0; // drr["Ok"] = false; Saldo = GetSaldo; } else { Saldo = GetSaldo; } } break; } } e.Cancel = true; return; } else if (Start) { string NamaKolom = GVDetailA.Columns[e.ColumnIndex].Name.ToString().ToUpper(); DataRow drr = (DataRow)(GVDetailA.Rows[e.RowIndex].DataBoundItem as DataRowView).Row; switch (NamaKolom) { case "RpADJ": { double RpSisa = Convert.ToDouble(drr["SaldoPiutang"]); // drr["Ok"] = true; if (Saldo - RpSisa >= 0) { drr["RpADJ"] = RpSisa; } else { drr["RpADJ"] = Saldo; } } break; case "OK": { if (Convert.ToBoolean(drr["Ok"]) == true) { drr["RpADJ"] = 0; drr["Ok"] = false; } else { double RpSisa = Convert.ToDouble(drr["SaldoPiutang"]); //drr["Ok"] = true; if (Saldo - RpSisa >= 0) { drr["RpADJ"] = RpSisa; } else { drr["RpADJ"] = Saldo; } } } break; } } } catch (Exception ex) { Error.LogError(ex); } }
private void dgvCategoryNames_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { OriginalCategoryName = dgvCategoryNames.CurrentCell.Value.ToString(); }
private void sverPDataGrid_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { //editing = true; }
public AsthmaValidator(object sender, DataGridViewCellCancelEventArgs ee) : base(sender, ee) { //Validate(); }
private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { }
internal void OnRowEnter(DataGridViewCellEventArgs e) { if (!this.dataConnectionState[2] && this.currencyManager.ShouldBind) { this.dataConnectionState[8] = true; try { if (((e.RowIndex != this.owner.NewRowIndex) && !this.dataConnectionState[0x10]) && (this.currencyManager.Position != e.RowIndex)) { try { this.currencyManager.Position = e.RowIndex; } catch (Exception exception) { if (System.Windows.Forms.ClientUtils.IsCriticalException(exception)) { throw; } DataGridViewCellCancelEventArgs args = new DataGridViewCellCancelEventArgs(e.ColumnIndex, e.RowIndex); this.ProcessException(exception, args, false); } IEditableObject current = this.currencyManager.Current as IEditableObject; if (current != null) { current.BeginEdit(); } } } finally { this.dataConnectionState[8] = false; } } }