窗体上有几个EDIT,当然对应着几个LABEL,判断当EDIT为空时,提示必须输入。
代码简单
procedure JudgeNull(ALabe: TLabel; AEdit: TEdit);
begin
if Trim(AEdit.Text) = '' then
begin
ShowMessagesl(ALabe.Caption + '不能为空');
AEdit.SelectAll;
AEdit.SetFocus;
Abort;
end;
end;
begin
JudgeNull(Label1, Edt_PosNo);
JudgeNull(Label2, Edt_ShopNo);
JudgeNull(Label3, edt_ShopName);
JudgeNull(Label4, Edt_DComputer);
JudgeNull(Label5, Edt_dserver);
JudgeNull(Label8, Edt_ddata);
JudgeNull(Label6, Edt_duser);
JudgeNull(Label9, Edt_dport);
end;
代码简单
procedure JudgeNull(ALabe: TLabel; AEdit: TEdit);
begin
if Trim(AEdit.Text) = '' then
begin
ShowMessagesl(ALabe.Caption + '不能为空');
AEdit.SelectAll;
AEdit.SetFocus;
Abort;
end;
end;
begin
JudgeNull(Label1, Edt_PosNo);
JudgeNull(Label2, Edt_ShopNo);
JudgeNull(Label3, edt_ShopName);
JudgeNull(Label4, Edt_DComputer);
JudgeNull(Label5, Edt_dserver);
JudgeNull(Label8, Edt_ddata);
JudgeNull(Label6, Edt_duser);
JudgeNull(Label9, Edt_dport);
end;