Mouse roller changes combobox SelectedItem not visible, wich fires SelectedIndexChanged event

J

João Araújo

Hi,

My form has several group, combo and textboxs. To make it easier to
reproduce I've simplified:
1) one group box with a combobox and a textbox and the combo has the focus;
2) the user first selects and item from combobox and the focus passes to
textbox;
3) user doubleclicks on textbox and the current groupbox which fires this:
a) current groupbox visible status changes to false;
b) based on the information the user selected on the combobox, a
DatagridView is displayed in another groupbox, changing focus to it;
c) and now, this is the problem, if the user uses the mouse roller then
combobox, in the invisible groupbox, SelectedItem is changed and I can't
explain why.

If the first groupbox stills visible, the problem does not occurs, but that
is not an aceptable solution, because the form remains with too much
information.

I hope my problem has become clear.

Thanks.
João.
 
J

Jared

If you are looking at intercepting MouseRoll and nulling it out, here is
some code I was typing today...


Public Class SpecialComboBox
Inherits ComboBox


Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

Const WM_COMMAND As Int32 = 273

Select Case True
Case m.Msg = WM_COMMAND And m.WParam = New System.IntPtr(66536) 'intercepts
WM_COMMAND (which prevent DropDownBox from closing after WM_LBUTTONDOWN)


'2 - (NEW) nulls MouseWheel on not .DropDown
If Not Me.DroppedDown Then
Exit Sub
End If

End Select


MyBase.WndProc(m)


End Sub

End class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top