Hai Ati,
so würde es bei mir wohl aussehen (ungetestet):
Delphi-Quellcode:
function TForm1.CheckInput: Boolean;
var datum:TDate;
zeit:TTime;
i: integer;
test:boolean;
tmpComponent : TComponent;
begin
test := True;
for i := 0 to Form1.ComponentCount -1 do
begin
if (tmpComponent is TMaskEdit) then // Test des MaskEdit
begin
test := MaskEditTest (tmpComponent as TMaskEdit);
end;
if (tmpComponent is TDateEdit) then // Test des DateEdit
begin
test := DateEditTest (tmpComponent as TDateEdit);
end;
if (tmpComponent is TCombobox) then // Test der ComboBox
begin
test := ComboTest (tmpComponent as TCombobox);
end;
if not (test) then
begin
break;
end;
end;
result := test;
end;
procedure TForm1.ADOQuery1BeforePost(DataSet: TDataSet);
begin
if not (CheckInput) then
begin
DataSet.Cancel;
ShowMessage('Bitte prüfen sie die Eingabe');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.Post;
end;
Stephan B.
"Lasst den Gänsen ihre Füßchen"