Reputation: 17
I have designed a Window_Form in which I want to give a functionality such that whenever a user press "Enter" Button in ComboBox, a query is executed.
Upvotes: 0
Views: 7660
Reputation: 1
private void txtShNumber_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter && txtShNumber.Text.Trim() != "")
{
/////your code
}
}
it will work for wpf and C# applications
Upvotes: 0
Reputation: 1705
Try this:
Private Sub Combobox_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Combobox.KeyDown
If e.KeyCode = Keys.Enter Then
MsgBox("Here you can execute query")
End If
End Sub
Upvotes: 1