Not moving to another cell after pressing Enter key for a Winform DataGrid

In some cases, you want the cursor staying in the same cell after entering data in a grid cell, then pressing "Enter" key with the System.Windows.Forms.DataGrid. I asked the same question for the Synchfusion GridControl and I got the answer. Synchfusion GridControl is not a data bound control. It has a property "EnterKeyBehavoir" which can be disabled to get the behavior I want. I need to know what I can do with the MS DataGrid and the Synchfusion GridDataBoundGrid. Thank you very much for your help. Jerry

1 Reply

AD Administrator Syncfusion Team December 20, 2005 09:55 AM UTC

Hi Pls put the following code in load event foreach(Control ct in dataGrid1.Controls){ if(ct is TextBox ){ TextBox t=ct as TextBox ; t.Validating+=new CancelEventHandler(t_Validating); } } then u write eventhandler t_Validating.in that u can cancel the change of focus by setting e.Cancel=true >In some cases, you want the cursor staying in the same cell after entering data in a grid cell, then pressing "Enter" key with the System.Windows.Forms.DataGrid. > >I asked the same question for the Synchfusion GridControl and I got the answer. Synchfusion GridControl is not a data bound control. It has a property "EnterKeyBehavoir" which can be disabled to get the behavior I want. I need to know what I can do with the MS DataGrid and the Synchfusion GridDataBoundGrid. > >Thank you very much for your help. > >Jerry >

Loader.
Up arrow icon