How to change DataGridViewEditMode to mouse click?

71 views Asked by At

I am using

DataGridViewComboBoxCell 

in my application and displaying some values . Suppose there are 3 values as follows :

admin    ABC   and  Xyz

First display item is admin My cell style is as :

comboControl.DropDownStyle = ComboBoxStyle.DropDown;

So user can edit the items after selecting it. My problem arises when user is editing item with the same name but with different case. As in detail, If he selected admin and he wants to change it to

ADMIN or aDmin or any other , then its value again becoming admin(as previous).

However , I am surprise to see that if user is writing any other text like

adminbbjds or hello or any thing , Its value get changed.

If you have any solution then please give me one!

This problem not arises when user is pressing enter after editing but arises when user click on any other point then its value becoming change.

I am using ,

this.gViewMainGridView.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.gViewMainGridView_EditingControlShowing);
private void gViewMainGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
    {
         DataGridViewComboBoxCell cell = gViewMainGridView.CurrentCell as DataGridViewComboBoxCell;
              DataGridViewComboBoxEditingControl comboControl = e.Control as DataGridViewComboBoxEditingControl;
             //comboControl.DropDownStyle = (DataGridViewComboBoxColumn)DataGridViewComboBoxDisplayStyle.ComboBox;
             if (comboControl != null)
             {
                comboControl.DropDownStyle = ComboBoxStyle.DropDown;         
             }
    }
0

There are 0 answers