Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i pop up calender in date time picker when i click a button in Windows.
i want pop calendar in dtp by click a button or select radio button
Posted

You handle your button click and you show a form that has a date picker in it.
 
Share this answer
 
Comments
vphashir 19-Jul-12 2:58am    
Thanks
As far as I know, the only way to do it is to simulate a mouse click:
C#
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool PostMessage(
IntPtr hWnd, // handle to destination window
Int32 msg, // message
Int32 wParam, // first message parameter
Int32 lParam // second message parameter
);

const Int32 WM_LBUTTONDOWN = 0x0201;

private void myOpenDTPButton_Click(object sender, EventArgs e)
    {
    Int32 x = myDateTimePicker.Width - 10;
    Int32 y = myDateTimePicker.Height / 2;
    Int32 lParam = x + y * 0x00010000;

    PostMessage(myDateTimePicker.Handle, WM_LBUTTONDOWN, 1, lParam);

    }
 
Share this answer
 
Comments
vphashir 19-Jul-12 2:58am    
thanks.....
its now working
OriginalGriff 19-Jul-12 3:14am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900