System.Windows.Forms.DataGridView.BeginEdit(bool)

Here are the examples of the csharp api class System.Windows.Forms.DataGridView.BeginEdit(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

8 Examples 7

1. Example

Project: ME3Explorer
Source File: PlotVarDB.cs
private void cellClicked(object sender, DataGridViewCellEventArgs e)
        {
            bool validClick = (e.RowIndex != -1 && e.ColumnIndex != -1); //Make sure the clicked row/column is valid.
            var datagridview = sender as DataGridView;

            // Check to make sure the cell clicked is the cell containing the combobox 
            if (validClick && datagridview.Columns[e.ColumnIndex] is DataGridViewComboBoxColumn)
            {
                datagridview.BeginEdit(true);
                ((ComboBox)datagridview.EditingControl).DroppedDown = true;
            }
        }

2. Example

Project: Ego-Engine-Modding
Source File: Form1.cs
private void dgv_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            ((DataGridView)sender).SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
            // Return if the cell isn't in a data column or if the row is the column headers
            if (e.ColumnIndex < 1 || e.RowIndex < 0)
            {
                return;
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                ((DataGridView)sender).CurrentCell = ((DataGridView)sender)[e.ColumnIndex, e.RowIndex];
                ((DataGridView)sender).BeginEdit(true);
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
            {
                ((DataGridView)sender).CurrentCell = null;
                ((DataGridView)sender).Rows[e.RowIndex].Selected = true;
            }
        }

3. Example

Project: Analysis-Services
Source File: TreeGridView.cs
protected override void OnKeyDown(KeyEventArgs e)
		{
			// Cause edit mode to begin since edit mode is disabled to support 
			// expanding/collapsing 
			base.OnKeyDown(e);
			if (!e.Handled)
			{
				if (e.KeyCode == Keys.F2 && this.CurrentCellAddress.X > -1 && this.CurrentCellAddress.Y >-1)
				{
					if (!this.CurrentCell.Displayed)
					{
						this.FirstDisplayedScrollingRowIndex = this.CurrentCellAddress.Y;
					}
					else
					{
						//TO_DO:calculate if the cell is partially offscreen and if so scroll into view
					}
					this.SelectionMode = DataGridViewSelectionMode.CellSelect;
					this.BeginEdit(true);
				}
				else if (e.KeyCode == Keys.Enter && !this.IsCurrentCellInEditMode)
				{
					this.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
					this.CurrentCell.OwningRow.Selected = true;
				}
			}
		}

4. Example

Project: BismNormalizer
Source File: TreeGridView.cs
protected override void OnKeyDown(KeyEventArgs e)
		{
			// Cause edit mode to begin since edit mode is disabled to support 
			// expanding/collapsing 
			base.OnKeyDown(e);
			if (!e.Handled)
			{
				if (e.KeyCode == Keys.F2 && this.CurrentCellAddress.X > -1 && this.CurrentCellAddress.Y >-1)
				{
					if (!this.CurrentCell.Displayed)
					{
						this.FirstDisplayedScrollingRowIndex = this.CurrentCellAddress.Y;
					}
					else
					{
						//TO_DO:calculate if the cell is partially offscreen and if so scroll into view
					}
					this.SelectionMode = DataGridViewSelectionMode.CellSelect;
					this.BeginEdit(true);
				}
				else if (e.KeyCode == Keys.Enter && !this.IsCurrentCellInEditMode)
				{
					this.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
					this.CurrentCell.OwningRow.Selected = true;
				}
			}
		}

5. Example

Project: vsSolutionBuildEvent
Source File: DataGridViewExt.cs
private void onControlPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if(sender == null || sender.GetType() != typeof(DataGridViewTextBoxEditingControl)) {
                return;
            }
            var box = (DataGridViewTextBoxEditingControl)sender;
            int pos = box.SelectionStart;

            if(box.Text.Length < 1) {
                return;
            }

            if(pos == 0 && e.KeyData == Keys.Left) {
                BeginEdit(false);
                box.SelectionStart = Math.Min(1, box.Text.Length); // will decrease with std handler
                return;
            }

            if(pos == box.Text.Length && e.KeyData == Keys.Right) {
                BeginEdit(false);
                box.SelectionStart = box.Text.Length - 1; // also will with std handler later
                return;
            }
        }

6. Example

Project: profit-calc
Source File: ProfitCalc.cs
private void dgvNeedsEdit_MouseUp(object sender, MouseEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (e.Button == MouseButtons.Left && dgv != null)
            {
                if (dgv.HitTest(e.X, e.Y).Type
                    == DataGridViewHitTestType.Cell)
                {
                    dgv.BeginEdit(true);
                }
                else
                {
                    dgv.EndEdit();
                }
            }
        }

7. Example

Project: scada
Source File: FrmReplace.cs
private bool ReplaceCellVal(ColumnInfo columnInfo, bool match, out bool updated)
        {
         /n ..... /n //View Source file for more details /n }

8. Example

Project: Ego-Engine-Modding
Source File: Form1.cs
void dgv_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) {
			if (e.ColumnIndex < 0 || e.RowIndex < 0 || ((DataGridView)sender).Columns.Count == 0) {
				return;
			}
			if (e.Button == System.Windows.Forms.MouseButtons.Middle) {
				DataTable child = (DataTable)((DataGridView)sender).DataSource;
				if (child.ExtendedProperties.Count == 0) {
					return;
				}
				if (child.ExtendedProperties.ContainsKey(((DataGridView)sender).Columns[e.ColumnIndex].Name) == true) {
					OpenTable((string)child.ExtendedProperties[((DataGridView)sender).Columns[e.ColumnIndex].Name]);
				}
			} else if (e.Button == System.Windows.Forms.MouseButtons.Right) {
				((DataGridView)sender).CurrentCell = ((DataGridView)sender)[e.ColumnIndex, e.RowIndex];
				((DataGridView)sender).BeginEdit(true);
			}
		}