用delphi自带Quickrep做报表问题(50分)

F

fwcy

Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi自带Quickrep做报表时,想进行这样赋值:
QRlabel1.caption:=QRexpr1.value;
编译时电脑提示错误:incompatible types:’string’and ’tqrevresult’
请问各位高手这个问题怎么解决?谢谢!
 
做一个值的转换
 
请问怎么转呀?
 

QRlabel1.caption:=Floattostr(QRexpr1.value);
等等
 
TO:FWCY,zhoulide
我也有这样一个问题,按zhoulide提供的方法是不行的!
系统会提示:incompatible types:’extended’and ’tqrevresult’
 
是类型不一致啊,你要先搞清楚那个QRexpr1.value返加的是一个什么类型。
 
作类型转换
 
在unit QRExpr里
TQREvResultType = (resInt, resDouble, resString, resBool, resError);
TQREvResult = record
case Kind : TQREvResultType of
resInt : (intResult : longint);
resDouble : (dblResult :do
uble);
resString : (strResult : string[255]);
resBool : (booResult : boolean);
end;
所以如果结果不是resError,那必定是longint,double,string[255],boolean里的一种
自己所个判断和类型变换吧
 
这个问题怎么解决呀?我也很想知道!
TO:佛法无边 作类型转换谁都知,但怎么转呀?
TO:mor 你写的那个东东不是DELPHI里的帮助吗?但怎么做呀?
 
其实你必要这么写代码啊
QRexpr1 控件本身就可以作为 LABEL使用,
 
such like this:
If QRExpr1.Value.Kind = resInt then
QRLabel1.Caption := inttostr(QRExpr1.Value.IntResult);
BTW:我也没用过TQRExpr,它好像是可以当QRLabel用的
 
to [red]learnerdelphi[/red]:
你说的帮助是哪里的?我正在忙一个打印方面的问题,没有文档,只好看原码,
so累。
 
TO:MOR 我想把TQRExpr的值放进一个函数里去调用,但这函数的输入值是字符型的!
所以我想把TQRExpr的结果值转换成字符型!
比如:调用EDIT1.TEXT:=IXCO(QRExpr1.Value),其中QRExpr1.Value一定要是自符型的!
我想FWCY应该和我一样的想法吧!
你要的帮助在DELPHI里有,我复制如下,你去看看吧!
type TQREvResultType = (resInt, resDouble, resString, resBool, resError)
type TQREvResult = record
case Kind : TQREvResultType of
resInt : (intResult : Longint);
resDouble : (dblResult :do
uble);
resString : (strResult : String[255]);
resBool : (booResult : Boolean);
end
property Value : TQREvResult
Description
Use the Value property to access the value of the Expression.
It returns a variant record with the result of the calculation.
See also
TQRExpr
 
[:(]还是没照照你说的什么帮助,看了看TQRExpr,好像没什么办法
自己写个函数吧
case QRExpr1.Kind of
resInt :result := inttostr(QRExpr1.Value.IntResult);
resDouble :result := floattostr(QRExpr1.Value.IntResult);
resString :result := QRExpr1.Value.IntResult;
resBool :result := booltostr(QRExpr1.Value.IntResult);
end;
当然如果你能确定返回值的数据类型,就直接用inttostr(QRExpr1.Value.IntResult)之类的
就行了
 
TO:MOR
inttostr(QRExpr1.Value.IntResult)是不行的,调试会出错!你去试试真的不行!
 
呵呵,这是个联合结构啊,看看pascal基础的书去吧,
为什么不用Expression来访问呢?
 
TO:Fontain
用Expression怎么访问呢?是EDIT1.TEXT:=IXCO(QRExpr1.Expression)这样吗?
这样肯定是不行的呀!QRExpr1.Expression只是一个表达式,不是一个结果值!
 
??????????调试的时候看一看QRExpr1.Value.Kind
如果它是resInt,inttostr(QRExpr1.Value.IntResult)就不应该有错啊
&
具体报的是什么错?
 
来自:fwcy, 时间:2002-9-23 12:51:00, ID:1340785
不是吧,這樣也頂
 
delphibbs上有答案!
 
顶部