0

I have a listbox which I have used as an autocomplete list in my C# windows application, which has events like MouseClick and Leave. On MouseClick, I want to set the selected value to a textbox. On Leave, I want to hide the listbox Now, the problem is, when I click on a value in listbox, the leave event is fired and listbox gets hidden without setting the value. If I unset the leave event, things work as expected.

NOTE: The purpose of Leave event is to only hide the listbox when some other control is clicked. The autocomplete textbox is implemented using this reference: WinForms | C# | AutoComplete in the Middle of a Textbox?

Community
  • 1
  • 1
SharpCoder
  • 49
  • 2
  • 8
  • To understand this better, if you hide it onLeave then how do you intent to click on it again? – snit80 Sep 19 '16 at 06:13
  • You cannot tinker with event order, it is hard-coded in the OS and the control. You can get code to run later pretty easily, but if you don't show your code then it is just a wild guess on how to use that feature appropriately. – Hans Passant Sep 19 '16 at 06:26

0 Answers0