473,503 Members | 8,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox drop-down window closing/hidden

I am trying to get an event when the drop-down Combo Box goes away /
reverts back to showing a single item.

For example, clicking the box's down arrow, to remove the drop-down
window, doesn't seem to generate any event. Not even a mouse event.
That seems a little odd.

Besides not finding a public event method, I can't seem to find a
protected method to over-ride either.

I am guessing I need to look for a message in ComboBox's WndProc().
But I don't know which message is the one I'm looking for.

Any ideas ?

Thanks...
Mar 21 '08 #1
3 3524
On Mar 21, 10:00 am, - HAL9000 <gu...@mail.orgwrote:
I am trying to get an event when the drop-down Combo Box goes away /
reverts back to showing a single item.

For example, clicking the box's down arrow, to remove the drop-down
window, doesn't seem to generate any event. Not even a mouse event.
That seems a little odd.

Besides not finding a public event method, I can't seem to find a
protected method to over-ride either.

I am guessing I need to look for a message in ComboBox's WndProc().
But I don't know which message is the one I'm looking for.

Any ideas ?

Thanks...
DropDownClosed event of combobox must be what you're looking for.
Mar 21 '08 #2
On Fri, 21 Mar 2008 02:32:01 -0700 (PDT), kimiraikkonen
<ki*************@gmail.comwrote:
>On Mar 21, 10:00 am, - HAL9000 <gu...@mail.orgwrote:
>I am trying to get an event when the drop-down Combo Box goes away /
reverts back to showing a single item.

For example, clicking the box's down arrow, to remove the drop-down
window, doesn't seem to generate any event. Not even a mouse event.
That seems a little odd.

Besides not finding a public event method, I can't seem to find a
protected method to over-ride either.

I am guessing I need to look for a message in ComboBox's WndProc().
But I don't know which message is the one I'm looking for.

Any ideas ?

Thanks...

DropDownClosed event of combobox must be what you're looking for.
Ahh, I see they added DropDownClosed() event for .net version 2. I
have to use version 1, so I can't use that.

That tip did lead me to the information I needed though (eg
CBN_CLOSEUP message):

http://groups.google.com/group/micro...74deef8895fc73
Changed that around a little to:

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
'WM_USER As Integer = &H400
'OCM__BASE As Integer = WM_USER + &H1C00
'WM_COMMAND As Integer = &H111
'OCM_COMMAND As Integer = OCM__BASE + WM_COMMAND
If m.Msg = (&H400 + &H111 + &H1C00) Then
Debug.WriteLine("WndProc Msg = " & Hex(m.Msg) & "h, LParam =
" & Hex(m.LParam.ToInt32) & "h, WParam = " & Hex(m.WParam.ToInt32) &
"h, HWnd = " & Hex(m.HWnd.ToInt32) & "h")
If (m.WParam.ToInt32 And &HF0000) = &H80000 Then
Debug.WriteLine("drop down window close message")
OnDropDownWindowClose(System.EventArgs.Empty)
End If
End If
MyBase.WndProc(m)
End Sub

Protected Overridable Sub OnDropDownWindowClose(ByVal e As
System.EventArgs)
RaiseEvent DropDownWindowClose(Me, e)
End Sub

Public Event DropDownWindowClose As EventHandler

Mar 21 '08 #3
On Mar 21, 11:21*pm, - HAL9000 <gu...@mail.orgwrote:
On Fri, 21 Mar 2008 02:32:01 -0700 (PDT), kimiraikkonen

<kimiraikkone...@gmail.comwrote:
On Mar 21, 10:00 am, - HAL9000 <gu...@mail.orgwrote:
I am trying to get an event when the drop-down Combo Box goes away /
reverts back to showing a single item.
For example, clicking the box's down arrow, to remove the drop-down
window, doesn't seem to generate any event. *Not even a mouse event.
That seems a little odd.
Besides not finding a public event method, I can't seem to find a
protected method to over-ride either.
I am guessing I need to look for a message in ComboBox's WndProc().
But I don't know which message is the one I'm looking for.
Any ideas ?
Thanks...
DropDownClosed event of combobox must be what you're looking for.

Ahh, I see they added DropDownClosed() event for .net version 2. *I
have to use version 1, so I can't use that.

That tip did lead me to the information I needed though (eg
CBN_CLOSEUP message):

http://groups.google.com/group/micro...languages.vb/m...

Changed that around a little to:

* *Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
* * * 'WM_USER As Integer = &H400
* * * 'OCM__BASE As Integer = WM_USER + &H1C00
* * * 'WM_COMMAND As Integer = &H111
* * * 'OCM_COMMAND As Integer = OCM__BASE + WM_COMMAND
* * * If m.Msg = (&H400 + &H111 + &H1C00) Then
* * * * *Debug.WriteLine("WndProc Msg = " & Hex(m.Msg) & "h, LParam =
" & Hex(m.LParam.ToInt32) & "h, WParam = " & Hex(m.WParam.ToInt32) &
"h, HWnd = " & Hex(m.HWnd.ToInt32) & "h")
* * * * *If (m.WParam.ToInt32 And &HF0000) = &H80000 Then
* * * * * * Debug.WriteLine("drop down window close message")
* * * * * * OnDropDownWindowClose(System.EventArgs.Empty)
* * * * *End If
* * * End If
* * * MyBase.WndProc(m)
* *End Sub

* *Protected Overridable Sub OnDropDownWindowClose(ByVal e As
System.EventArgs)
* * * RaiseEvent DropDownWindowClose(Me, e)
* *End Sub

* *Public Event DropDownWindowClose As EventHandler- Hide quoted text -

- Show quoted text -
I think it's your time to jump .net 2.0 at least. DropDownClosed is
well-wrapped event rather than writing low-level Win32 API calls as
you described above.
Mar 21 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
308
by: Jade | last post by:
Hi, i wanted to know how i can make a combo readonly. at the moment the user can edit the values in the combobox at runtime
2
2105
by: NewSun | last post by:
The combobox can drop and be selected,but the display member or text showing can't be edit. Thanks in advance.
3
6805
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
3
4557
by: amber | last post by:
Hello, I have 6 comboboxes, that I thought I could bind to the same datasource, and have them display different 'selectedvalue's', but apparently I can't... My code is as follows: dim drv as...
4
1807
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection,...
1
1706
by: Drakemar | last post by:
What I thought was a real simple thing to do has out not to be. I have a real simple Access database with two tables: Student Table id (autonumber) *primary key* name (text) teacherID (int)...
1
374
by: Ferdinand Zaubzer | last post by:
Hello, I am trying to insert some Text via drag and drop into the editable area of a combobox. The problem is, that I can't get the current charIndex of the selected Text via the mouse cursor...
3
1005
by: bh | last post by:
I'm trying to define a combobox on a form and make it accessible to another form. I drop the control onto the form in Visual Studio (2003), but when I go into the code-behind and add the "shared"...
0
2455
by: alexia.bee | last post by:
Hi All, I am trying to get the index of an item that the mouse is pointing/ hovering at. Meaning, when user click the Combobox, droplist is show. When you hover the mouse on item, it highlight...
1
866
by: GS | last post by:
I got a detailed view of bound sql dataset table. what is the best ways to allow user to select values via combobox on some of the table columns? O know a way of using another table from the same...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.