internal clsBeatChords(Forms.IFrmDGV frm, DataGridView dgv) { DGV = dgv; Frm = frm; DGV_CellValidating_Handler = new DataGridViewCellValidatingEventHandler(DGV_CellValidating); DGV.CellValidating += DGV_CellValidating_Handler; //DGV.CellValidating += new DataGridViewCellValidatingEventHandler(DGV_CellValidating); }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// datagridviewcellvalidatingeventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this DataGridViewCellValidatingEventHandler datagridviewcellvalidatingeventhandler, Object sender, DataGridViewCellValidatingEventArgs e, AsyncCallback callback) { if (datagridviewcellvalidatingeventhandler == null) { throw new ArgumentNullException("datagridviewcellvalidatingeventhandler"); } return(datagridviewcellvalidatingeventhandler.BeginInvoke(sender, e, callback, null)); }
private void setUpHandlers() { DefaultValuesNeeded += new DataGridViewRowEventHandler(FormattedGridView_DefaultValuesNeeded); CellValidating += new DataGridViewCellValidatingEventHandler(FormattedGridView_CellValidating); this.RowEnter += new DataGridViewCellEventHandler(FormattedGridView_RowEnter); this.CausesValidation = true; UserAddedRow += new DataGridViewRowEventHandler(displayArrayGrid_DoubleClick2); CellEnter += new DataGridViewCellEventHandler(FormattedGridView_CellEnter); CellFormatting += new DataGridViewCellFormattingEventHandler(FormattedGridView_CellFormatting); EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(FormattedGridView_EditingControlShowing); this.RowsRemoved += new DataGridViewRowsRemovedEventHandler(FormattedGridView_RowsRemoved); CellBeginEdit += new DataGridViewCellCancelEventHandler(FormattedGridView_CellBeginEdit); }
/// <summary> /// Constructor /// </summary> public EnhancedGrid() { InitializeComponent(); CellDoubleClick += new DataGridViewCellEventHandler(OnCellDoubleClick); CellClick += new DataGridViewCellEventHandler(OnCellClick); CellValidating += new DataGridViewCellValidatingEventHandler(OnCellValidating); DataError += new DataGridViewDataErrorEventHandler(OnDataError); EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(OnEditingControlShowing); RowHeadersVisible = false; // Populate the context menu. ToolStripMenuItem CopyItem = (ToolStripMenuItem)PopupMenu.Items.Add("Copy"); CopyItem.ShortcutKeys = Keys.Control | Keys.C; CopyItem.Click += new EventHandler(OnCopy); ToolStripMenuItem PasteItem = (ToolStripMenuItem)PopupMenu.Items.Add("Paste"); PasteItem.ShortcutKeys = Keys.Control | Keys.V; PasteItem.Click += new EventHandler(OnPaste); ToolStripMenuItem DeleteItem = (ToolStripMenuItem)PopupMenu.Items.Add("Delete"); DeleteItem.ShortcutKeys = Keys.Delete; DeleteItem.Click += new EventHandler(OnDelete); PopupMenu.Items.Add(new ToolStripSeparator()); ToolStripMenuItem MoveDownItem = (ToolStripMenuItem)PopupMenu.Items.Add("Move down"); MoveDownItem.ShortcutKeys = Keys.Control | Keys.Down; MoveDownItem.Click += new EventHandler(OnMoveDown); ToolStripMenuItem MoveUpItem = (ToolStripMenuItem)PopupMenu.Items.Add("Move up"); MoveUpItem.ShortcutKeys = Keys.Control | Keys.Up; MoveUpItem.Click += new EventHandler(OnMoveUp); ContextMenuStrip = PopupMenu; }