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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TDateTimePicker component

Status
Not open for further replies.

criss7

Technical User
May 5, 2006
4
RO
Who want to help and teach me?
I have a table which has a date field.
I want to build a form with two TDateTimePicker components and a TButton (OK button).
One TDateTimePicker component for "from date", other for "to date".
When I select the dates and click the OK button I wish to open a Report form with all dates from the table which are data field within the interval. I don't know what I must write in source code. I read a lot of tutorials but I can't find one with TDateTimePicker component.
Please there is a nice person who want to help me?
Thank you very much.
 
I frequently do stuff like that. You will need to pull the dates from the TDateTimePicker components. Something like:
Code:
TDate StartDate = StartDateTimePicker->Date;
TDate EndDate = EndDateTimePicker->Date;

I named one TDateTimePicker StartDateTimePicker and named the other one EndDateTimePicker. I pull only the date from these but you could pull the DateTime, too. If this case, you would need to use TDateTime instead of TDate like I used.

Next you will need to get this date into you query somehow. Since you didn't mention how you are quering the table, I'll not show you an example but you might be able to use the date as is or convert it to a string or AnsiString.


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thank you very much. Indeed I made a query with two Params: "FromDate" and "ToDate" but the things now is more complicated for me. :)
Question: where must put the code which you wrote me?? because I have "Set" and "Get". Please look at the code on the bottom of message:

//---------------------------------------------------------------------
void TData::SetFromDate(TDate NewDate)
{

}
//---------------------------------------------------------------------
void TData::SetToDate(TDate NewDate)
{

}
//---------------------------------------------------------------------
TDateTime TData::GetFromDate()
{

}
//---------------------------------------------------------------------
TDateTime TData::GetToDate()
{

}
//---------------------------------------------------------------------
 
I pu the code on the OnClick method for the OK button or on a routine the OnClick method calls. It looks like you are trying to make if more complicated than it needs to be.


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thank you very, very much.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top