【问题标题】:How to get fastreport memo value如何获取 fastreport 备忘录值
【发布时间】:2019-06-10 03:14:47
【问题描述】:

我很难从 fastreport 到 delphi 获取备忘录值。我在 fastreport 中有一个带有计算值的备忘录,我想获取这个值并将其发送到我的 delphi 编辑文本。

我尝试了这段代码,但结果只是文本而不是值

txtValue.text := TfrxMemoView(frxReport1.FindComponent('Memo3')).Text;

【问题讨论】:

  • 我不明白。这是一个备忘录。这些包含文本。如果您想将结果放入 TEdit 中,这正是您所需要的,不是吗?
  • 我的备忘录文本被计算 [memo1.value + memo2.value]
  • 请展示Memo1.ValueMemo2.Value 的简单示例以及您期望的计算值以及实际值与预期的偏差。
  • @UliGerhardt TfrxMemoView 组件有两个属性TextValue,OP 在他的问题中提到了Value 属性,看来他可以访问Text 并且不要'不知道如何访问Value 属性。

标签: delphi delphi-xe2 fastreport


【解决方案1】:

你可以这样做

begin
    // Get Text property 
    txtValue.text := TfrxMemoView(frxReport1.FindComponent('Memo3')).Text;
    // Get Value property
    txtValue.text := TfrxMemoView(frxReport1.FindComponent('Memo3')).Value;
end;

如果您想连接来自TextValue 属性的两个字符串,那么

procedure TForm1.Button1Click(Sender: TObject);
begin
    // Set the Text property
    TfrxMemoView(frxReport1.FindObject('Memo3')).Text:= 'MyFirstString';
    // Set the Value property
    TfrxMemoView(frxReport1.FindObject('Memo3')).Value:= 'MySecondString';
    // Concatenate the strings and assign the result to the TEdit.Text property
    txtValue.Text:= Concat(TfrxMemoView(frxReport1.FindObject('Memo3')).Text,
                           ' ',
                           TfrxMemoView(frxReport1.FindObject('Memo3')).Value
                          );
end;

【讨论】:

  • 使用临时变量,至少在 Concat 行中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-27
  • 2021-08-05
相关资源
最近更新 更多