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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting combobox text

Thread ID:





78908 Jan 9,2009 08:43 PM UTC Jan 12,2009 06:58 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On January 9, 2009 08:43 PM UTC

I am trying to prevent the user from deleting the text in a combobox. The style is autocomplete, exclusive is set to true, but the user can still select the text inside and delete it using the delete key, backspace key, or any combination of these keys with control, alt, shift key. The CurrentCellDeleting event doesn't seem to trap this.

Also, if you put control inside the combobox and hit Control+Delete, the entire combobox disappears. How do i prevent this as well.

I am using the GridControl, version


Jisha Joy [Syncfusion]
Replied On January 12, 2009 06:58 AM UTC

Hi Julie,

We appreciate your interest in Syncfusion products.

The mentioned issues can be avoided by handling CurrentCellDeleting and CurrentCellKeyDown events. Please see the code:

this.gridControl1.CurrentCellDeleting += new CancelEventHandler(gridControl1_CurrentCellDeleting);
this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown);

void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
bool ctl = (e.KeyData & Keys.Control) != 0;

bool del = (e.KeyData & Keys.Delete) != 0;

if (ctl && del) // Check for CTRL+del
e.Handled = true;

void gridControl1_CurrentCellDeleting(object sender, CancelEventArgs e)
GridCurrentCell cc = this.gridControl1.CurrentCell;
if (this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "ComboBox")
e.Cancel = true;



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon