关于combobox 和日期运算的问题(5分)

  • 主题发起人 主题发起人 晨空
  • 开始时间 开始时间

晨空

Unregistered / Unconfirmed
GUEST, unregistred user!
我刚发现,原来combobox中没有readonly属性,问:应该怎么样使combobox中的内容程现
可读状态?
另:在做查询操作时,我想查一下年龄为40岁的所有人,但表中只有出生年月字段,我该
怎么样用语言来表示 年龄为40的所有人? 日期型数据的运算应该怎么样来进行?
 
select* from table
where borndate<:date1
function IncYear(const AValue: TDateTime; const ANumberOfYears: Integer = 1): TDateTime;

Description

IncYear returns the value of the AValue parameter, incremented by ANumberOfYears years. ANumberOfYears can be negative, to return a date N years previous.

The time of day specified by the AValue parameter is copied to the result.

可以给出负数
 
第一个问题,你可以用Enabled属性控制,在你想要它只读的时候
Enabled:=false;
 
看看下面的例子:
在form上放一个combobox控件和一个button控件,在button的click事件中写如下代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
combobox1.Enabled:=not combobox1.Enabled;
case combobox1.Enabled of
true:button1.Caption:='只读' ;
false:button1.Caption:='读写' ;
end;
end;
是不是对你的问题有点启发?
 
后退
顶部