Results 1 to 3 of 3

Thread: [RESOLVED] [2008] Combobox click event when another control has focus

  1. #1

    Thread Starter
    Addicted Member Sully's Avatar
    Join Date
    Nov 2002
    Location
    Lost in the far recesses of one's own mind.
    Posts
    165

    Resolved [RESOLVED] [2008] Combobox click event when another control has focus

    Hi All,

    I've finally moved over to .net and as always I get plenty of extremely useful information from this forum. I usually find what I need just by searching, but I haven't had any luck with this particular problem.

    My question is why does clicking on a combo box which does not have focus fire off the gotfocus, dropdown, and dropdownclosed event without any other action. I have a windows form with several text boxes within a tablelayoutpanel control. When the combobox gets focus it works just as expected. But when another control has focus and you click on the combo box the drop down list appears and disappears before you can do anything else, and the combo box then gets the focus. Clicking it again and everything is fine. I placed debug statements in each event to trace what was happening. I do not have code, other than for debugging purposes, in any of the gotfocus, dropdown, and dropdownclosed events. I have set the combo box dropdownstyle to dropdownlist, and I set CausesValidation to false. I've tested this from every possible control I can, with the same result. I do have code in several of the other combobox events, but these events are not firing on the click.

    I'm sure I'm missing something, but what? I hope this fully explains the problem.
    Disclaimer:

    * The preceding message was in no means meant to be critical, mean spirited, insincere, or facetious.

    Disclaimer for disclaimer:

    The preceding disclaimer may in fact be facetious in nature.

    Thanks,
    Jim

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,289

    Re: [2008] Combobox click event when another control has focus

    When you click on a control, that control becomes focused. Plain and simple. So it doesn't matter which control on your form is currently having the focus, as soon as you click on the combobox, the combobox has the focus.
    Now, in order to know what is possibly causing the described behavior, we need more information. What combobox events are handled? By any chance are you handling the GotFocus or Enter event of the combobox?
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Addicted Member Sully's Avatar
    Join Date
    Nov 2002
    Location
    Lost in the far recesses of one's own mind.
    Posts
    165

    Re: [2008] Combobox click event when another control has focus

    Thanks for replying stanav, I'm going to mark this resolved. I did have one statement in the gotfocus event, which set the droppeddown property to true. When a commented this out, the problem went away. I thought for a fact I had already tried that, but maybe I did not. I tried so many combinations I couldn't possibly recall all of them.
    Disclaimer:

    * The preceding message was in no means meant to be critical, mean spirited, insincere, or facetious.

    Disclaimer for disclaimer:

    The preceding disclaimer may in fact be facetious in nature.

    Thanks,
    Jim

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