C# Programming
12-25-2012, 08:41 AM
Hi all,
I have a textbox with autocomplete set to suggest.
I want to execute my code in the Textbox_KeyDown event on the enter key,
but enter key is also invoked when I select an item from the text box autocomplete items.
That is not what I want.
I want the selected item in the textbox and then execute my code.
code:
private void opdrverwTextbox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == (Keys.Enter) && !string.IsNullOrEmpty(opdrverwTextbox.Text)) { //here is the problem. In debugging if I select from dropdown // with mouse click: e.KeyData = LButton | MButton | Back e.Handled = true; a lot of other code........; } opdrverwTextbox.Clear(); opdrverwTextbox.Visible = false; opdrverwLabel.Visible = false; dataGridView_Update(); } }
I don't want to set autocomplete to suggest-append.
is there a workaround for this?
Merry Christmas, Groover
b>
0200 A9 23
0202 8D 01 80
0205 00
I have a textbox with autocomplete set to suggest.
I want to execute my code in the Textbox_KeyDown event on the enter key,
but enter key is also invoked when I select an item from the text box autocomplete items.
That is not what I want.
I want the selected item in the textbox and then execute my code.
code:
private void opdrverwTextbox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == (Keys.Enter) && !string.IsNullOrEmpty(opdrverwTextbox.Text)) { //here is the problem. In debugging if I select from dropdown // with mouse click: e.KeyData = LButton | MButton | Back e.Handled = true; a lot of other code........; } opdrverwTextbox.Clear(); opdrverwTextbox.Visible = false; opdrverwLabel.Visible = false; dataGridView_Update(); } }
I don't want to set autocomplete to suggest-append.
is there a workaround for this?
Merry Christmas, Groover
b>
0200 A9 23
0202 8D 01 80
0205 00