Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DropDown

55 views
Skip to first unread message

Claudio

unread,
Apr 15, 2004, 9:39:01 PM4/15/04
to
I have a form with two buttons (b1 and b2), a datetimepicker and a combobox.
Is there a way to when a press b1 button the datetimepicker drops down, and
whe I press b2 the combobox drops down ?


Praveen Ramesh

unread,
Apr 15, 2004, 11:34:40 PM4/15/04
to
Setting comboBox.DroppedDown to true will let you show the combo's dropdown
programatically. I don't think there is an easy way to do this with the
datetimepicker.

-Praveen
visit www.syncfuison.com for .Net Essentials
http://www.syncfusion.com/faq/winforms/


"Claudio" <news.microsoft.com> wrote in message
news:%23DlsYO1...@TK2MSFTNGP10.phx.gbl...

Tim Wilson

unread,
Apr 15, 2004, 11:57:16 PM4/15/04
to
The DateTimePicker will display it's calendar when it receives an F4
keypress. So you can simulate this by setting focus to the DateTimePicker
and then sending it an F4.

private void button1_Click(object sender, System.EventArgs e)
{
this.dateTimePicker1.Focus();
SendKeys.Send("{F4}");
}

--
Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"Praveen Ramesh" <rpra...@syncfusion.com> wrote in message
news:%23V6vOP2...@TK2MSFTNGP11.phx.gbl...

Tim Wilson

unread,
Apr 16, 2004, 12:15:25 AM4/16/04
to
I should have pointed out that this is a simple method that will work as
long as the F4 key is not being used as a shortcut to something else, like a
menu item. If this is the case then you could always PInvoke SendMessage and
send the message directly to the control.

using System.Runtime.InteropServices;

private const int WM_KEYDOWN = 0x0100;
private const int VK_F4 = 0x73;

[DllImport("User32.dll")]
private static extern int SendMessage(IntPtr hWnd, int iMsg, int wParam, int
lParam);

private void button1_Click(object sender, System.EventArgs e)
{
this.dateTimePicker1.Focus();

SendMessage(this.dateTimePicker1.Handle, WM_KEYDOWN, VK_F4, 0);
}

--
Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:eLOtUb2I...@TK2MSFTNGP12.phx.gbl...

Claes Bergefall

unread,
Apr 16, 2004, 3:32:41 AM4/16/04
to
Or you can send it an Alt+Down key instead
this.dateTimePicker1.Focus();
SendKeys.Send("%{DOWN}");

/claes


"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message

news:elzGel2I...@TK2MSFTNGP09.phx.gbl...

0 new messages