We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Restricting key hits in a cell !!

Hi I have a very simple Question . if I put a focus on a particular cell thru mouse and then click Delete then the value in the cell gets deleted . If I make that particular cell as disabled then in that case it works fine since I am not able to edit so question of deletion does not exists, but I can not make that cell as disabled as I have text in that cell which is not visible completely so i have to click in the cell and using that right arrow key I can see the text .So is there any way with which i can simply make use of the right arrow key and the left arrow key .just to scroll thru the cell. I hope I am able to make you understand the Problem. This is the code which i had used. Private Sub strategyPeriodGrid_CurrentCellControlKeyMessage(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellControlKeyMessageEventArgs) Handles strategyPeriodGrid.CurrentCellControlKeyMessage Dim keyCode As Keys If strategyPeriodGrid.CurrentCell.ColIndex = 1 Then keyCode = CType(e.Msg.WParam.ToInt32, Keys) And Keys.KeyCode If keyCode <> Keys.Right OrElse keyCode <> Keys.Left Then e.Handled = True e.Result = True End If End If End Sub

3 Replies

AD Administrator Syncfusion Team June 24, 2005 07:43 PM UTC

If you want to avoid clearing the cell''s contents when you press the Delete key, try setting the style.ReadOnly = true for that cell. Then I think you should be able to click the cell to activate it and use teh arrow keys without having to subscribe to teh CurrrentCellControlKeyMessage event.


LL Lokesh Luthra June 24, 2005 07:54 PM UTC

Yes Clay but When I am making that cell as readonly then in that case that the right arrow and the left arrow key does not work , >If you want to avoid clearing the cell''s contents when you press the Delete key, try setting the style.ReadOnly = true for that cell. Then I think you should be able to click the cell to activate it and use teh arrow keys without having to subscribe to teh CurrrentCellControlKeyMessage event.


AD Administrator Syncfusion Team June 24, 2005 09:20 PM UTC

Readonly normally does not affect the arrow key behavior. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GC_ReadOnlyArrowKeys_5414d88.zip Now when you get to the end of the word, and you press teh arrow again, it does move to teh next cell by default.

Loader.
Live Chat Icon For mobile
Up arrow icon