Recent

Author Topic: How to display first memo line in DBGrid  (Read 409 times)

erictan

  • Jr. Member
  • **
  • Posts: 52
How to display first memo line in DBGrid
« on: June 11, 2020, 05:28:53 am »
I have a Customer Form displaying all the fields of a Customer table in a DBGrid.
The address field is a Memo field and only shows "Memo" in the DBGrid.
How do I show the first line of the Address memo field instead of just showing "Memo" in the DBGrid.

I have tried googling for a solution without success.

All suggestions and advise are greatly appreciated.

eljo

  • Sr. Member
  • ****
  • Posts: 408
Re: How to display first memo line in DBGrid
« Reply #1 on: June 11, 2020, 06:07:34 am »
A quick google search reveals the following link.
https://wiki.lazarus.freepascal.org/Grids_Reference_Page#Example:_Avoid_displaying_text_fields_as_.22.28Memo.29.22_for_DBGrids

I'd bet a search in the forum will reveal a number of threads with the same theme.

erictan

  • Jr. Member
  • **
  • Posts: 52
Re: How to display first memo line in DBGrid
« Reply #2 on: June 11, 2020, 08:56:24 am »
Thank you eljo for your reply, nteresting link which I will explore further.

Essentially I want to be able to extract all the fields, including Memo fields, using 'Select * From" and do some editing but to display only the first line of each memo field in the DBGrid so that I know the content of each memo field.

I would thought that this could be possible by specifying in the Object inspector Fieldname as 'address.lines[1]'.

This feature is easily and similarly done in the Visual Foxpro IDE.

paweld

  • Full Member
  • ***
  • Posts: 241
Re: How to display first memo line in DBGrid
« Reply #3 on: June 11, 2020, 10:21:32 am »
you can also get it using OnGetText event - sample in attachement.
Best regards
paweld

 

TinyPortal © 2005-2018