Hi.
Follow this Steps:
create new application in c#.net
place 1 combobox and 1 textbox on form
on PreviewKeyDown Event for combobox write a code also for text box
now run the application and set focus to combobox and press any key!
the code you typed run 2 times!! but for textbox run only 1 times!
very thanx
exeuse me for bad english!
Loading
ali gholamiPosted Oct 4, 2009, 1:28 AM
but i want to handle key down event until my code in previewkeydown event run one time and pressed key no writen to combobox,
for example when i press Ctrl+S on combobox, saveButton click event occure one time and "s" no writen to combobox.
exeuse me for bad english!
Master BillaPosted Oct 3, 2009, 2:17 AM
This is occur before the key down event.So you can write like this way to move your combo box
Here is to
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.previewkeydown.aspx
thank you
Dushan StankovicPosted Oct 2, 2009, 3:00 PM
When you set DropDownStyle property to DropDownList this event occurs only one time, but if you set other two value to DropDownStyle prop event occurs two times.
I think that is event is raised first time for keyboard key pressed and second time for printing pressed key at text field.
I didn't find any different answer on the web.
This example is for debug purpose only: