Thread View: borland.public.delphi.database
2 messages
2 total messages
Started by Mike Zmuda
Thu, 07 Sep 2006 21:56
Memo fields in TDBGrid
Author: Mike Zmuda
Date: Thu, 07 Sep 2006 21:56
Date: Thu, 07 Sep 2006 21:56
40 lines
2326 bytes
2326 bytes
Hello,
Does anybody know how to get a TDBGrid to display Memo fields from a database?
I've tried doing things with the DrawDataCell event, but it doesn't even
trigger.
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
Var
P : Array[0..50] of Char;
BS : tBlobStream;
S : String;
begin
S := '';
If Field is TMemoField then Begin
With (Sender as TDBGrid).Canvas do Begin
BS := tBlobStream.create(TBlobField(Field),bmRead);
FillChar(P,SizeOf(P),#0);
BS.Read(P,50);
BS.Free;
S := StrPas(P);
While Pos(#13,S) > 0 do S[POS(#13,S)] := ' ';
While Pos(#10,S) > 0 do S[Pos(#10,S)] := ' ';
FillRect(Rect);
TextOut(Rect.Left,Rect.Top,S);
end;
end;
end;
What am I doing wrong / is there an easier way to get the TDBGrid to display a
memo field?
(Specifically, I'm not looking for another component to display memo fields - I
have those. I'm looking to see the specific memo using the default TDBGrid
component that ships with Delphi 2006.)
Thanks -
Mike Z.
Re: Memo fields in TDBGrid
Author: Riki Wiki
Date: Fri, 08 Sep 2006 02:42
Date: Fri, 08 Sep 2006 02:42
8 lines
1097 bytes
1097 bytes
Hoi Mike You need to repost your question on the Borland news server to make everybody see it and possibly answer your question. Further, this news group do not officially exist, the group to use is b.p.d.database.general. How to post to Delphi newsgroups: <http://delphi.wikia.com/wiki/Delphi_Newsgroups>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads