DateTimePicker set date from fields in a database.

Started by Anonymous, December 28, 2005, 05:30:41 PM

Previous topic - Next topic

Anonymous

I'd like to use the datetimepicker to format dates for mij database. Whe changing record it should place the date from the field in the database:

FF_TextBox_SetText(HWND_FRMMANPRJ_DTPSTART, SQL_ResColStr(4))FF_TextBox_SetText(HWND_FRMMANPRJ_DTPEND, SQL_ResColStr(5))

It only displays the current date. I'v tried to find out how to do this by searching the helpfiles but found nothing.

Can somebody help me?

Thanks in advance. :cry:

TechSupport

I haven't used the DateTimePicker control very much but the documentation for it is available at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/datetime/reflist.asp

It looks like you need to use the DTM_SETSYSTEMTIME function:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/datetime/macros/datetime_setsystemtime.asp

Here is an example: Sets the date to Jan 31, 2005


   Local SysTime As SYSTEMTIME
   
   SysTime.wYear  = 2005
   SysTime.wMonth = 12
   SysTime.wDay   = 31
   
   DateTime_SetSystemtime HWND_FRMMANPRJ_DTPSTART, %GDT_VALID, SysTime

Anonymous

Thanks, this helped me a lot. Yhe syntax is now:

Dim stDate As SYSTEMTIME

stDate.wYear = Val(SQL_ResColDate(4, "yyyy"))
stDate.wMonth = Val(SQL_ResColDate(4, "MM"))
stDate.wDay = Val(SQL_ResColDate(4, "dd"))
DateTime_SetSystemtime HWND_FRMMANPRJ_DTPSTART, %GDT_VALID, stDate
           
stDate.wYear = Val(SQL_ResColDate(5, "yyyy"))
stDate.wMonth = Val(SQL_ResColDate(5, "MM"))
stDate.wDay = Val(SQL_ResColDate(5, "dd"))
DateTime_SetSystemtime HWND_FRMMANPRJ_DTPEND, %GDT_VALID, stDate

CU.