各位领导:有个PASCAL语言的问题想请教。(0分)

  • 主题发起人 主题发起人 bluesky1000
  • 开始时间 开始时间
B

bluesky1000

Unregistered / Unconfirmed
GUEST, unregistred user!
问题对于您们来说非常之简单,但对于我来说(初次学习PASCAL),实在是有些解不开。
我有这样一个关于人员档案管理的程序:
在输入页面中,有一些dbedit,其中“姓名”一栏是dbedit1,“职工号”一栏是dbedit3,
我想做成的效果是,如果“姓名”一栏未输入,出个提示,再进入编辑状态,"职工号"一
栏如果未输入,也出个提示,进入编辑状态。当这两栏都有输入时,就可以出个提示,然后
就dbnavigator1.bitclick(nbpost);了,可是我却怎么也做不出判断两栏都有输入时的语句
,这段源码如下,请大大们给俺医医病:
procedure TForm2.ToolButton8Click(Sender: TObject);
begin
toolbutton8.Enabled:=false;
dbimage1.enabled:=false;
dbedit1.enabled:=false;
dbedit2.enabled:=false;
dbedit3.enabled:=false;
dbedit4.enabled:=false;
dbedit5.enabled:=false;
dbedit6.enabled:=false;
dbcombobox1.enabled:=false;
dbcombobox2.enabled:=false;
dbcombobox3.enabled:=false;
dbcombobox4.enabled:=false;
dbcombobox5.enabled:=false;
dbcombobox6.enabled:=false;
dbcombobox7.enabled:=false;
dbcombobox8.enabled:=false;
dbcombobox9.enabled:=false;
dbdateedit1.enabled:=false;
dbdateedit1.enabled:=false;
dbgrid2.enabled:=false;
dbgrid3.enabled:=false;
if dbedit1.Text='' then
begin
dbnavigator1.BtnClick(nbedit);
toolbutton8.Enabled:=true;
application.MessageBox('他(她)叫什么?您忘了输入姓名啦!:)','出错儿啦!',mb_ok);
dbimage1.enabled:=true;
dbedit1.enabled:=true;
dbedit2.enabled:=true;
dbedit3.enabled:=true;
dbedit4.enabled:=true;
dbedit5.enabled:=true;
dbedit6.enabled:=true;
dbcombobox1.enabled:=true;
dbcombobox2.enabled:=true;
dbcombobox3.enabled:=true;
dbcombobox4.enabled:=true;
dbcombobox5.enabled:=true;
dbcombobox6.enabled:=true;
dbcombobox7.enabled:=true;
dbcombobox8.enabled:=true;
dbcombobox9.enabled:=true;
dbdateedit1.enabled:=true;
dbdateedit1.enabled:=true;
if tabbednotebook1.ActivePage='家庭成员' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end
else
if tabbednotebook1.ActivePage='个人简历' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end;
end;
if dbedit3.Text='' then
begin
dbnavigator1.BtnClick(nbedit);
toolbutton8.Enabled:=true;
application.MessageBox('他(她)的职工号是多少?您忘了输入职工号啦!:)','出错儿啦!',mb_ok);
dbimage1.enabled:=true;
dbedit1.enabled:=true;
dbedit2.enabled:=true;
dbedit3.enabled:=true;
dbedit4.enabled:=true;
dbedit5.enabled:=true;
dbedit6.enabled:=true;
dbcombobox1.enabled:=true;
dbcombobox2.enabled:=true;
dbcombobox3.enabled:=true;
dbcombobox4.enabled:=true;
dbcombobox5.enabled:=true;
dbcombobox6.enabled:=true;
dbcombobox7.enabled:=true;
dbcombobox8.enabled:=true;
dbcombobox9.enabled:=true;
dbdateedit1.enabled:=true;
dbdateedit1.enabled:=true;
if tabbednotebook1.ActivePage='家庭成员' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end
else
if tabbednotebook1.ActivePage='个人简历' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end;
end;
if dbedit1.Text<>'' then
  //关键在这儿。在这里怎样做个判断语句,用以判断两
                栏都有输入,再post呢?是不是if dbedit1.text<>'' and dbedit3.text<>'' then
????
dbnavigator1.BtnClick(nbpost);
end;


在线等待您的帮助。万分感谢!
 
if (dbedit1.text<>'') and (dbedit3.text<>'') then
 
我也是这样用的
应该没有问题!
同楼上!
 
haha,so easy
 
谢谢各位对我的帮助,我按几位对我的建议试了试,改了一下,却成了另一种结果:
procedure TForm2.ToolButton8Click(Sender: TObject);
begin
toolbutton8.Enabled:=false;
dbimage1.enabled:=false;
dbedit1.enabled:=false;
dbedit2.enabled:=false;
dbedit3.enabled:=false;
dbedit4.enabled:=false;
dbedit5.enabled:=false;
dbedit6.enabled:=false;
dbcombobox1.enabled:=false;
dbcombobox2.enabled:=false;
dbcombobox3.enabled:=false;
dbcombobox4.enabled:=false;
dbcombobox5.enabled:=false;
dbcombobox6.enabled:=false;
dbcombobox7.enabled:=false;
dbcombobox8.enabled:=false;
dbcombobox9.enabled:=false;
dbdateedit1.enabled:=false;
dbdateedit2.enabled:=false;
dbgrid2.enabled:=false;
dbgrid3.enabled:=false;
if dbedit1.Text='' then
begin
dbnavigator1.BtnClick(nbedit);
toolbutton8.Enabled:=true;
application.MessageBox('他(她)叫什么?您忘了输入姓名啦!:)','出错儿啦!',mb_ok);
dbimage1.enabled:=true;
dbedit1.enabled:=true;
dbedit2.enabled:=true;
dbedit3.enabled:=true;
dbedit4.enabled:=true;
dbedit5.enabled:=true;
dbedit6.enabled:=true;
dbcombobox1.enabled:=true;
dbcombobox2.enabled:=true;
dbcombobox3.enabled:=true;
dbcombobox4.enabled:=true;
dbcombobox5.enabled:=true;
dbcombobox6.enabled:=true;
dbcombobox7.enabled:=true;
dbcombobox8.enabled:=true;
dbcombobox9.enabled:=true;
dbdateedit1.enabled:=true;
dbdateedit2.enabled:=true;
if tabbednotebook1.ActivePage='家庭成员' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end
else
if tabbednotebook1.ActivePage='个人简历' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end;
end;
if dbedit3.Text='' then
begin
dbnavigator1.BtnClick(nbedit);
toolbutton8.Enabled:=true;
application.MessageBox('他(她)的职工号是多少?您忘了输入职工号啦!:)','出错儿啦!',mb_ok);
dbimage1.enabled:=true;
dbedit1.enabled:=true;
dbedit2.enabled:=true;
dbedit3.enabled:=true;
dbedit4.enabled:=true;
dbedit5.enabled:=true;
dbedit6.enabled:=true;
dbcombobox1.enabled:=true;
dbcombobox2.enabled:=true;
dbcombobox3.enabled:=true;
dbcombobox4.enabled:=true;
dbcombobox5.enabled:=true;
dbcombobox6.enabled:=true;
dbcombobox7.enabled:=true;
dbcombobox8.enabled:=true;
dbcombobox9.enabled:=true;
dbdateedit1.enabled:=true;
dbdateedit2.enabled:=true;
if tabbednotebook1.ActivePage='家庭成员' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end
else
if tabbednotebook1.ActivePage='个人简历' then
begin
dbgrid2.enabled:=true;
dbgrid2.ReadOnly:=false;
dbgrid3.enabled:=true;
dbgrid3.ReadOnly:=false;
end
else
if (dbedit1.Text<>'') and (dbedit3.text<>'') then
dbnavigator1.BtnClick(nbpost);
application.MessageBox('成功录入!:)','恭喜!恭喜!',mb_ok);
end;
end;

结果就是不管dbedit1和dbedti3中有没有<>'',在显示完“他(她)叫什么?您忘了输入姓名啦!:)”和“他(她)的职工号是多少?您忘了输入职工号啦!:)”的提示后,程序都会出来“成功录入”的提示。
请问这是怎么回事?我的程序有错吗?
 
在dbedit1和dbedit3的onexit事件中写入:
if (trim(dbedit1.text)='') then
begin
dbedit1.setfocuse;
exit;
end;
 
后退
顶部