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
close icon

delete key versus ctrl-delete

During some testing I accidently hit ctrl delete on a cell. Then when I tried to close my form it blew up because i was trying to do a conversion to a single and it then thought it was text. I have a attached a sample I wanted you to try. Run the sample and then if you hit the delete key on cell 1,1 and click the first button it will change the text next to that button to 0 like it should. If you click that cell again and hit ctrl delete and then click the second button you will see in the text box next to it that it doesnt display anything. This doesnt happen in our app that is live now using 3110 of your grid. Now the reason I think that is, is because all of those forms in our live version have clearing cells events. In this new version of the grid of yours and the way you changed null values and empty strings and all that around we dont use clearing cells on some forms per stefans advice and some things he fixed for us. It''s almost like you are deleting the style or something. Is there a simple way to solve this and always put the zero in there and if not is there a way to just disable ctrl delete?

CTRL Delete.zip

2 Replies

AD Administrator Syncfusion Team July 22, 2006 09:33 AM UTC

If you want to see a zero when you press ctl+del and avoid the problem you described, I think you can do it with the event handler below. If you just want to ignore the ctl+del, then you can just set the e.handled in the event code and not use the other code.

I will forward this issue onto the dev team to see if this is something they want to try to address in our code. I suspect the proper behavior would be to just ignore the ctl+del so it does not cause any problem, but we will have to research the issue to see what is going on before we decide what to do.


Private Sub gc1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles gc1.CurrentCellKeyDown
If e.Control AndAlso e.KeyCode = Keys.Delete Then
Me.gc1.CurrentCell.Renderer.Control.Text = "0"
Me.gc1.CurrentCell.Refresh()
e.Handled = True
End If
End Sub


PB Philip Bishop July 24, 2006 02:48 PM UTC

That works great. I am just disabling it and not putting in the zero. One other thing I noticed that is related to this has to do with horizontal alignment. When we first started setting up grids we always set that up in the code. In the sample I sent I did it in the range collection for the grid in the ide. If you right click on the horizontalalignment in the range collection and reset it and then put it in the code as right aligned, hitting ctrl delete has a different outcome. Then it left aligns the zero in that cell. I dont know if thats related or some other quirk. Just thought I would point it out. Thanks again.

Loader.
Live Chat Icon For mobile
Up arrow icon