Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
// Sender contains a reference to "Button1" so the following code
// is not correct and will fail
If (TEdit(Sender).Text <>'') then
ShowMessage('Edit field not empty ')
else
ShowMessage('Edit fieldempty ')
end;
Here is a little helper function:
Delphi-Quellcode:
function EditHasData(edit:TEdit):Boolean;
begin
// TrimRight removes blanks
result := TrimRight(edit.Text) <> '';
end;
Using the helper function you can write:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
if EditHasData(Edit1)and EditHasData(Edit2) and EditHasData(Edit3)
and EditHasData(Edit4)and EditHasData(Edit5) and EditHasData(Edit6) then
ShowMessage('all Edits are filled with data')
else
ShowMessage('there is at least one empty Edit');
end;