Question

Hello I came across this problem a few months back and had time today to check out how to do it. I have a TDbgrid in which I apply a filter to filter contents of a Firebird database. I would like to print out the content after filtering it. I had researched and studied and this what I came up so far:

I put a Tprintdialog component on the page along with a Tbutton and had this code on it:

procedure Tviewrecord.Button3Click(Sender: TObject);
begin
 with PrintDialog1.Create(nil) do
    try
      if Execute then
        Dbgrid4.print;
    finally
      Free;
    end;

Problem is that when I am compiling, there is an error on the "print: part of the code.

Thanks.

Was it helpful?

Solution

Your code fails to compile for the rather prosaic reason that the TDBGrid control does not have a Print method. You'll need to write the printing code yourself, or find a third party component with printing capabilities.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top