Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
11756 | Mar 15,2004 05:15 PM UTC | Apr 23,2010 11:34 AM UTC | WinForms | 11 |
![]() |
Tags: GridControl |
private void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e) { bool ctl = ((Control.ModifierKeys & Keys.Control) != 0); if(ctl && e.KeyCode == Keys.Enter) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; string newValue = cc.Renderer.ControlText; GridRangeInfo range = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange; if(range.Height > 1 || range.Width > 1) { this.gridDataBoundGrid1.Model.ChangeCells(range, newValue); e.Handled = true; } } }
private void gridDataBoundGrid1_ValidateFailed(object sender, GridValidateFailedEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
cc.ErrorMessage = "MyMessage";
}
try { this.gridDataBoundGrid1.Model.ChangeCells(range, newValue); } catch { cc.Lock(); MessageBox.Show("Cannot complete..."); cc.Unlock(); cc.RejectChanges(); this.gridDataBoundGrid1.Binder.CancelEdit(); } e.Handled = true;
>try >{ > this.gridDataBoundGrid1.Model.ChangeCells(range, newValue); >} >catch >{ > cc.Lock(); > MessageBox.Show("Cannot complete..."); > cc.Unlock(); > cc.RejectChanges(); > this.gridDataBoundGrid1.Binder.CancelEdit(); >} >e.Handled = true; >
for(int row = range.top; row <= range.Bottom; ++row)
{
for(int col = range.Left; col <= range.Right; ++col)
{
this.gridDataBoundGrid1[row, col].Text = newValue;
}
}
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.