怎样编写程序才可让一个TDBEdit是要用户必须输入的???

guorui 2002-04-03 09:30:11
eg:edtRepID是一个TDBEdit控件
我在OnExit事件中编写了程序:
if edtRepID.text='' then
begin
showmessage('Rep ID is required.');
edtRepID.setfocus();
end;

但是我发觉在edtRepID控件中输入了字符之后,edtRepID.text的值依然为空。
这到底是什么回事??不解???

请问大家有什么办法解决这个问题?是否只能在beforePost事件中来判断呢?
其他事件或OnExit事件可以做到么?
...全文
37 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
guorui 2002-04-03
  • 打赏
  • 举报
回复
to:windinance
谢谢你多次帮我,也谢谢大家,
今天回去试试,明天给分!!
My_first 2002-04-03
  • 打赏
  • 举报
回复
if length(edtrepid.text)<1 then
begin
....
showmessage('输入错误');
edtrepid.setfocus;
end;
就表示里面没有字符
windindance 2002-04-03
  • 打赏
  • 举报
回复
if edtRepID.text='' then ...
应该也是行的
可能其他什么事件中的代码不正确
yuefengzzh 2002-04-03
  • 打赏
  • 举报
回复
windindance(风舞轻扬) ,我想问为何他的不行呀?
Liusp 2002-04-03
  • 打赏
  • 举报
回复
sc
webnumen 2002-04-03
  • 打赏
  • 举报
回复
同意斑竹的说法!两棵星就是不一样!
windindance 2002-04-03
  • 打赏
  • 举报
回复
if VarToStr(Table.FieldValues['field']) = '' then
begin
showmessage('Rep ID is required.');
edtRepID.setfocus();
end;

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧