Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datetimepicker control

Status
Not open for further replies.

rnrn

Programmer
Joined
Aug 23, 2002
Messages
8
Location
GB
Can someone save me a lot of time and post sthe code needed to put the value of a dateteime picker control into a text field? This is urgent and I'm no Visual C++ programmer so need you help.
 
Ok here goes...
void CTestDlg::OnCloseupDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
UpdateData();
if(pNMHDR->idFrom == IDC_DATETIMEPICKER1)
{
CDateTimeCtrl* pDateTimeCtl = (CDateTimeCtrl*)GetDlgItem(pNMHDR->idFrom);
CTime DateTime;
pDateTimeCtl->GetTime( DateTime );
CString strDateTime = DateTime.Format("%A, %B %d, %Y");
CEdit* pEditCtl = (CEdit*)GetDlgItem(IDC_EDIT1);
pEditCtl->SetWindowText(strDateTime);
UpdateData(FALSE);
}
*pResult = 0;
}

hope this helps
 
Phew? All this just to put the value of a DateTimePicker control into another text box on a dialog when it changes?
 
This works when i create an exe but if I try to create a DLL then I get threee errors. Two are because GetDlgItem can't accept 1 parameter and the orher is because UpdateData can't either. Why do I get this for a DLL and not for an exe?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top