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

#include <vcl.h>
#pragma hdrstop

#include "CompConversion.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------

// BeginExample: CompConversion
// Routine: System.CompToCurrency
// Routine: System.CompToDouble

// BeginCode

/*
This example demonstrates Comp conversion functions.
*/

void __fastcall TForm2::Button1Click(TObject *Sender)
{
	Comp CompValue;
	Currency CurrencyValue;

	try {
		CompValue = StrToInt64(Edit1->Text);
		CurrencyValue = CompToCurrency(CompValue);
		Edit2->Text = CurrToStr(CurrencyValue);
		}
	catch (...) {
		MessageDlg("Enter a signed integer with abs value <= 9 * 10**18", mtError,
			TMsgDlgButtons() << mbOK, 0);
	}
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button2Click(TObject *Sender)
{
	Comp CompValue;
	Double DoubleValue;

	try {
		CompValue = StrToInt64(Edit3->Text);
		DoubleValue = CompToDouble(CompValue);
		Edit4->Text = FloatToStr(DoubleValue);
		}
	catch (...) {
		MessageDlg("Enter a signed integer with abs value <= 9 * 10**18", mtError,
			TMsgDlgButtons() << mbOK, 0);
	}
}

// EndCode
// EndExample: CompConversion

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

