[RESOLVED] Insert symbol in a combobox using combination of keys
Hello,
I am trying to type something in a combobox and when I press for example ALT+a I would like a symbol like "ΓΈ" to be inserted at cursor position.
I tried this:
Private Sub ComboBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Alt And e.KeyCode = 65 Then
ComboBox1.Text = "test"
End If
End Sub
but it doesn't seem to do anything.
So, 2 questions.
1. How can I detect the combination of keys pressed.
2. Is there a function to detect cursor position and insert the text or do I have to create the string myself?
Thx
Re: Insert symbol in a combobox using combination of keys
1. Follow the Blog link in my signature and check out my post on Keyboard Events for the answer to your question and more.
2. Set the SelectedText property of the ComboBox, which will insert at the caret if no text is selected and replace if text is selected.
Re: Insert symbol in a combobox using combination of keys
Great. I made it work. Thank you very much. Topic solved.