//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "EncodeTime.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: EncodeTime
// Routine: SysUtils.EncodeTime
// Routine: SysUtils.TimeToStr

// BeginCode
/*
This example uses three edit controls, a label, and a button
on a form. When the button is clicked, the day, month, and
year specified in the edit controls is stored in a TDateTime
object. Then the TDateTime object is converted to an
AnsiString that is displayed in the label.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TDateTime dt;
  try
  {
    dt = EncodeTime((Word)StrToInt(Edit1->Text), (Word)StrToInt(Edit2->Text), (Word)StrToInt(Edit3->Text), (Word)StrToInt(Edit4->Text));
    Label1->Caption = TimeToStr(dt);
  }
  catch(...)
  {
    ShowMessage("Invalid hour, minute, second, or millisecond.");
  }
}
// EndCode
// EndExample: EncodeTime
//---------------------------------------------------------------------------
