CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Posts
    2

    ComboBox item click in DataGridView

    I'm using a comboboxcell in a datagridview with the combobox autocompletemode set to SuggestAppend.

    When I enter the cell and start typing, the autocomplete window pops up. When I click an item in the autocomplete list, the cell value is set and the cell exits edit mode. This has the same effect as selecting an item with up/down arrow keys from the autocomplete list and pressing the enter key.)

    I want to copy that behaviour when an item is selected from the combobox dropdown list.
    E.g. if the user clicks the dropdown arrow button to open the dropdown list, then clicks an item in the list, the cell value should be set to that item, the dropdown should close, and the cell should exit edit mode.

    I've tried adding a handler to the combobox mouse click event, but the combobox only seems to receive that event if the main part of the combobox is clicked, but not if the mouse is clicked somewhere in the dropdown part. I don't think this matters if the combobox is used in a datagridview or by itself.

    Does anyone know how to capture a mouse click in the dropdown part of the combobox? I'm hoping there's a way to do this without resorting to catching messages in the wndproc.

  2. #2
    Join Date
    May 2010
    Posts
    2

    Re: ComboBox item click in DataGridView

    I forgot to mention - I'm using VS 2008. This project is targeting the .NET framework 2.0

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: ComboBox item click in DataGridView

    the selected index changed event fires when you click an item in the combo box
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured