I did not know of the the existence of TDateEdit. Yes ithat works well.
I added a KeyUp event to make sure only numbers are entered:
procedure TForm8.DateEdit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// excluding the entry of date separators "-" and "/"
IF Key IN [189,191] THEN BEGIN
DateEdit1.Text:= Copy(DateEdit1.Text,1,Length(DateEdit1.Text)-1);
DateEdit1.Selstart:= Length(DateEdit1.Text) END;
//placing the date separator "-"
IF (Length(DateEdit1.Text) IN [2,5]) THEN BEGIN
DateEdit1.Text:= DateEdit1.Text + '-';
DateEdit1.SelStart:= Length(DateEdit1.Text) +1 END;
end;
Thanks for the advice and for me the topic is solved,
Teunis