Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Datagridview ComboBox DropDown Menu is visble outside control
 

Datagridview ComboBox DropDown Menu is visble outside control

Ihave datagrid control with 10 coclums. All of them are Combo Box columns. But only 5 of them can be visible at a time and hence there is the Horizontal Scroll Bar. If I click on a cell of a partially visble column, the drop down window of the combo box assoicated to the cell is displayed partially outside the datagrid view control.

I am using the following code in the mouse click event of a cell to display the Drop Down Menu in a single click. Is there a way to correct the problem. I want to display the dropdown menu within the datagridview

dataGrid.BeginEdit(true);

DataGridViewComboBoxEditingControl editingControl= (DataGridViewComboBoxEditingControl)dataGrid.EditingControl;

editingControl.DroppedDown =

true;

I am looking forward for the responses
void Func  Thursday, July 16, 2009 3:57 PM
Hi MANULIJI,

That seems I have understood you correctly. I don't think there is a better solution for that. If I handle the CellBeginEdit to set FirstDisplayedCell of the DataGridView to the currentCell, it really can avoid that problem. But in doing this, user won't feel good because it seems the cell is jumping.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
  • Marked As Answer byvoid Func Tuesday, July 21, 2009 1:44 PM
  •  
Kira Qian  Tuesday, July 21, 2009 2:43 AM
Hi MANULIJI,

Do you mean the ComboBox drop down menu's bottom exceed the DataGridView bottom? So some part of the menu will be outside of DataGridView?

Based on my experience, it is not possible to change that drop down behavior. DataGridView is not a contain which can hold the combobox drop down menu. That is equal to put a combobox at the bottom of a form so the drop down menu always partly outside that form.

If I misunderstood you, please correct me. Screen shot is helpful to let us understand it.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Monday, July 20, 2009 8:07 AM

Hi Kira Qian,

My problem is with the right most column which is partially visible. When I click a cell on this column, the drop down menu appears, a part of it is inside the datagrid view and the remaining part is outside the right of datagridview. The portion visible outside the datagridview is exactly the width of the hidden portion of the column.

The problem is similar to the one you specified.

I don't know how to add a screenshot.

Manu

void Func  Monday, July 20, 2009 3:18 PM
Hi MANULIJI,

That seems I have understood you correctly. I don't think there is a better solution for that. If I handle the CellBeginEdit to set FirstDisplayedCell of the DataGridView to the currentCell, it really can avoid that problem. But in doing this, user won't feel good because it seems the cell is jumping.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
  • Marked As Answer byvoid Func Tuesday, July 21, 2009 1:44 PM
  •  
Kira Qian  Tuesday, July 21, 2009 2:43 AM

You can use google to search for other answers

Custom Search

More Threads

• Garbage Collector and Windows Forms with designer built Dataset
• relational databinding in combobox
• Ilist and Ibindinglist interface importance
• BindingSource cannot be its own data source
• Can a binding source have no current item?
• DataGridView - slow
• Datagridview and ID field
• Updating dataset with non-identity Output parms from a stored procedure.
• Where is the DataGridView CurrentRowIndex ??? Please Help
• Localization and right to left text