jmcilhinney said:Just set the DroppedDown property to True in the GotFocus event handler.
Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
'Get the current cursor position.
Dim currentCursorPosition As Point = Cursor.Position
'Move the cursor to the combo box drop down button and set the cursor image.
Cursor.Position = Me.ComboBox1.PointToScreen(New Point(Me.ComboBox1.Width - 10, 10))
Me.ComboBox1.Cursor = Cursors.Default
'Drop down the list.
Me.ComboBox1.DroppedDown = True
'Reset the cursor position.
Cursor.Position = currentCursorPosition
End Sub
jmcilhinney said:The mouse cursor is working exactly as it always does. What happens is that when the list drops down, the cursor for the form stays exactly as it was at the moment the list dropped down until the list rolls up again. When you click the ComboBox the cursor is an arrow, and so you don't want it to change so it's not a problem. The way around this is to move the cursor to the ComboBox button, set the pointer image, drop down the list, and then move the cursor back to where it was if you want to.Whether or not you do this you have another problem though. If the ComboBox does not have focus and you click it, then the GotFocus event is raised and the list drops down, and then the Click event is raised and the list rolls up again.VB.NET:Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus 'Get the current cursor position. Dim currentCursorPosition As Point = Cursor.Position 'Move the cursor to the combo box drop down button and set the cursor image. Cursor.Position = Me.ComboBox1.PointToScreen(New Point(Me.ComboBox1.Width - 10, 10)) Me.ComboBox1.Cursor = Cursors.Default 'Drop down the list. Me.ComboBox1.DroppedDown = True 'Reset the cursor position. Cursor.Position = currentCursorPosition End Sub
.DroppedDown = True
Cursor.Current = Cursors.Default
Cursor.Current = Cursors.Default
JByro1 said:I found that using the
coupled with theVB.NET:.DroppedDown = True
will produce the desired effect.VB.NET:Cursor.Current = Cursors.Default
My problem was that I had the user type criteria for a search into the combo box, and then populated the box with the results and droped it down. As stated above, the combo box will hold the last cursor until it is rolled back up. So, when the user was typing, the cursor will hide itself. So by calling theCode, the mouse cursor will re-appear allowing the user to make a selection from the list!VB.NET:Cursor.Current = Cursors.Default