Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 269
Viewed: 2196
Added: Jul 26, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Selecting An Item From The DBCombo

Click event of the DBCombo is activated not only when the user clicks on an item in the list part of the DBCombo but also when clicking in the textbox part. This is undesirable when an application requires procedures to be carried out when the user selects an item from the list part but should not be carried out when the user clicks in the textbox part.
The following code enables a selection procedure to be activated only when the user selects an item from the list. The selection may be made either by clicking with the mouse or by using the navigational keys.

Highlight all by clicking in box

Highlight All
Private PreviousDBComboText As String
Private MouseDown As Boolean
Private Sub DBCombo1_Click(Area As Integer)
If MouseDown And DBCombo1.Text <> PreviousDBComboText Then
End If
MouseDown = False
End Sub

Private Sub DBCombo1_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyDown, vbKeyUp, vbKeyPageDown, vbKeyPageUp
Case Else
End Select
End Sub

Private Sub DBCombo1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
PreviousDBComboText = DBCombo1.Text
MouseDown = True
End Sub

Private Sub ItemSelected()
'Enter here any code which needs to be activated after a selection has been made
MsgBox DBCombo1.Text & " was selected."
End Sub

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 All Rights Reserved. Conditions