combobox

  • Thread starter Thread starter Scott Toney
  • Start date Start date
Hi Scott,

Set the Focus to your ComboBox and send the ENTER keyboard event using
keybd_event. Here's some sample code for sending keyboard events

[DllImport("coredll.dll")]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int
dwExtraInfo);

const int KEYEVENTF_KEYPRESS = 0x0000;
const int KEYEVENTF_KEYUP = 0x0002;

void SendKey(System.Windows.Forms.Keys key) {
keybd_event((byte)key, 0, KEYEVENTF_KEYPRESS, 0); // key press
keybd_event((byte)key, 0, KEYEVENTF_KEYUP, 0); // key release
(KEYEVENTF_KEYUP)
}
 
Alternatively you can send a CB_SHOWDROPDOWN message to the control.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

Christian Resma Helle said:
Hi Scott,

Set the Focus to your ComboBox and send the ENTER keyboard event using
keybd_event. Here's some sample code for sending keyboard events

[DllImport("coredll.dll")]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int
dwExtraInfo);

const int KEYEVENTF_KEYPRESS = 0x0000;
const int KEYEVENTF_KEYUP = 0x0002;

void SendKey(System.Windows.Forms.Keys key) {
keybd_event((byte)key, 0, KEYEVENTF_KEYPRESS, 0); // key press
keybd_event((byte)key, 0, KEYEVENTF_KEYUP, 0); // key release
(KEYEVENTF_KEYUP)
}


--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com


Scott Toney said:
Is there anyway to automagically open/drop down a combobox?

Thanks
 
Back
Top