How to see if ComboBox is in DropDown State? - vba

I have searched several forums but did not find answer for checking whether ComboBox is already DroppedDown via VBA code.
I have other code on Form_KeyDown events due to which anytime I press vbKeyDown it moves to next record. I need to check if ComboBox is DroppedDown then don't use other code and instead treat the default functionality of access where vbKeyDown will start scrolling through the items of ComboBox displayed in DropDown.

There is no such property, neither an event for OnDropDown or similar.
If the combobox has focus, you can force a dropdown using the DropDown method, but that's as close you can get.

Related

VueJs - How can i call an event when the cursor focus out in the combobox field

I have a combobox field in the screen and i need to call an event when i click on save button after typing a new text in this combobox field which is not currently available in the dropdown list.
My seniors told me to use focusout event to get this, but i don't know how to get this.
I am using combobov.vue to show dropdown
Please help me out.
I am able to fix issue by using #blur. Thanks everyone for the comments, especially Boussadjra Brahim

Opposite of SetFocus

MSAccess VBA:
Assume, in an arbitrary form, the focus is set to MyControl on that form.
How to "unset" the focus without giving the focus to another control?
I'm lokking for a code like
MyControl.UnsetFocus
In your circumstance, you probably want to just set focus back to the parent form. This meets the conditions of unsetting focus without giving another control focus, and tabbing or clicking will activate the focus / tab-navigation again from that form.
Here's an example:
Forms![MyForm].SetFocus
Note that per the documentation for SetFocus, if you attempt to SetFocus to a Form with child controls that have Enabled set, this will cause focus to automatically bounce to the first eligible child control per the documentation.
Form.SetFocus method (Access) # Microsoft Docs
The option to give focus to the parent form does work as proposed by meklarian
Alternatively, I recently had to do something similar but I wanted to update a textbox value and simply go back to whatever had focus before. This is another case where something like an "unsetfocus" would be awesome, but unfortunately doesn't exist.
Should you need to do something like this, the following works well
Screen.PreviousControl.SetFocus

Windows form freezes when bound combobox selection is made

I have a pretty simple form that brings up a certain record when the "caseNumber" is selected from the combobox. Although after a selection is made within the combobox, it will freeze the entire form on the record selected. I can't click on any other text boxes or buttons. I have to stop the debugger. No errors are thrown. I've read where this has happened to others, but no answers to the problem, that I can find.
There is no code behind it so far, as the form is bound to a dataset and should just bring up the rest of the information once the caseNumber is selected.
Changed the "Selected Value" dropbox to "none" on the data binding menu for the combobox.
Under DataBindings, go to Advanced and make sure DataSource update mode is on NOne
A lot of times this happens because there is a problem in the binding. Are you sure it's not binding the text value of the control(the combobobox) to the data?
The correct way to bind (under DataBindings, Advanced) was to bind it to the SelectedValue instead of Text.
Please let us know a little bit more how your combobox is binded.

vb.net Listview selectedItemChanged event fires when trying to select already selected item

Anyone has a clue what might go wrong? This behaviour happens after I make some changes in the grid that associates properties to the items in the listview, select a different item, at save prompt I cancel and revert the selection, now if I try to select the already selected item event fires. I dont know why.
I do change the selection programatically when I revert the selection if I cancel at the save promt.
I managed to reproduce this problem. It's resolved if you set the MultiSelect property to false. However, if you need multiple selections, another solution will be needed.
A UserControl 'wrapper' around the ListView that handles the SelectedItemChanged event and only responds if the item is different is an option.

VB.NET Databound ComboBox need to force update in datasource when selection changes

I have a combobox where the SelectedValue on the combo is bound to a property on a business object.
Everything works fine, but the property that's bound to the SelectedValue on the combo only gets updated when the focus leaves the control. I understand that the property doesn't get updated until the control is validated (loses focus), but I need it to update the datasource as soon as the dropdown is closed.
I know I could probably leave focus from the control on the DropDownClosed event but I'd prefer something a little less kludgy.
What's the best way to immediately update my datasource when the dropdown is closed?
Set the DataSourceUpdateMode to OnPropertyChanged. Here is similar problem:
[http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/bc39342b-d9b5-4ad0-bd35-073869ccf8be][1]
The way I'd do it is to set (in the events) the OnUpdate of the combo box and put in the VB.net
Me.<business object>.Requery