procedure TForm1.FormShow(Sender: TObject);
begin
with DataModule2.ADOQuery_GZBM do
begin
Close;
SQL.Clear;
SQL.Add('select * from GZBMK');
Open;
end;
If DataModule2.ADOQuery_GZBM.FieldByName('BMBM').Value = null then
begin
Application.MessageBox('该表数据为空,请向该表中插入数据。','提示',0+64);
BitBtn1.Enabled := False;
BitBtn2.Enabled := False;
BitBtn5.Enabled := False;
BitBtn6.Enabled := False;
BitBtn7.Enabled := False;
end
else
EditValue;
// DisableEdit;
end;
procedure TForm1.EditValue;
begin
if DataModule2.ADOQuery_GZBM.FieldByName('BMBM').Value <> null then
begin
Edit1.Text := DataModule2.ADOQuery_GZBM.FieldByName('BMBM').Value;
Edit2.Text := DataModule2.ADOQuery_GZBM.FieldByName('BMMC').Value;
Edit3.Text := DataModule2.ADOQuery_GZBM.FieldByName('HZBS').Value;
// Edit4.Text:= DataModule2.ADOQuery_GZBM.FieldByName('编号').Value;
end
else
begin
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
end;
end;
{procedure TForm1.FindNext;
begin
if FindNextControl(ActiveControl,True,False,False)is TEdit then
if TEdit(FindNextControl(ActiveControl,True,False,False)).Enabled = True then
TEdit(FindNextControl(ActiveControl,True,False,False)).SetFocus
else
begin
ActiveControl := FindNextControl(ActiveControl,True,False,False);
FindNext;
end;
end; }
end.
以上是子窗体的程序代码,就是在子窗体显示时出现的!