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

textbox cell and delete key

I had a question regarding the pressing of the delete key and how it reacts in a textbox cell versus a currency cell. when u use the delete key in a single currency cell it will put a zero in the cell for you somehow. does it do this because its a currency cell??? can u change this value???? if u have many cells selected and hit delete then it goes to my clearingcells event where I put the zero in all the cells. in a textbox cell its works the same on many cells and goes to my clearing cells event and zeros out all the cells. however if i click delete on a textbox single cell it just deletes out the value. now i''m assuming it does this because its not a currency box. is there any way to make the text box cell put a zero or whatever i want when the user hits the delete key in the cell. i cant seem to find where the delete key is doing this on a currency cell and was hoping i could make the textbox cell act like the currency box cell Thanks Phil

1 Reply

AD Administrator Syncfusion Team May 25, 2004 11:44 AM UTC

I think you can catch the delete key in this situation using the CurrentCellKeyDown event.
private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
	if(!this.gridControl1.CurrentCell.IsEditing && e.KeyCode == Keys.Delete)
		e.Handled = true;
		GridCurrentCell cc = this.gridControl1.CurrentCell;
		this.gridControl1[cc.RowIndex, cc.ColIndex].Text = "0";

Live Chat Icon For mobile
Up arrow icon