Einzelnen Beitrag anzeigen

question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

check TEdit field

  Alt 10. Okt 2013, 22:38
Hi,
I have a Form which contains six TEdit component, i would like to check whether the TEdit field is empty or not, i can do it with the following code
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin

 if (Edit1.Text<>'')and (Edit2.Text<>'') and (Edit3.text<>'')
  and (Edit4.Text<>'')and (Edit5.Text<>'') and (Edit6.text<>'')then
    ShowMessage('Edit field not empty ')
  else
    ShowMessage('Edit fieldempty ')

end;
is it possible to do it in another way, for example
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin

If (TEdit(Sender).Text <>'') then
     ShowMessage('Edit field not empty ')
  else
    ShowMessage('Edit fieldempty ')

end;
  Mit Zitat antworten Zitat