Solved

Search string in a Memo

Posted on 2001-07-27
8
246 Views
Last Modified: 2010-04-06
I have a paradox table with a TMemo.  How can I found a string in that memo.  Pos(MyString, Table1Memo) do work.
Thanks.
0
Comment
Question by:syloux
8 Comments
 
LVL 6

Expert Comment

by:edey
ID: 6328009
how about:

pos(myString,table1Memo);

or

pos(lowerCase(myString),lowerCase(table1Memo.text));

GL
Mike
0
 

Author Comment

by:syloux
ID: 6328027
Pos(MyString, Table1Memo) do not work.
Missing a "not" in the question, sorry.
0
 
LVL 6

Expert Comment

by:edey
ID: 6328144
Sorry, typo:

pos(myString,table1Memo.text);

Gl
Mike
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6329287
Hello

  Add findDialog to ur form and write this code in the OnFind event

procedure TForm1.FindDialog1Find(Sender: TObject);
var Buffer, Pos, tPointer : PChar;
    BuffLength            : Word;
begin
   With Sender as TFindDialog do
   begin
      GetMem(tPointer, Length(FindText) + 1);
      StrPCopy(tPointer, FindText);
      BuffLength:= Memo1.GetTextLen + 1;
      GetMem(Buffer,BuffLength);
      Memo1.GetTextBuf(Buffer,BuffLength);
      Pos:= Buffer + Memo1.SelStart + Memo1.SelLength;
      Pos:= StrPos(Pos, tPointer);
      if Pos = NIL then MessageBeep(0)
      else
      begin
         Memo1.SelStart:= Pos - Buffer;
         Memo1.SelLength:= Length(FindText);
      end;
      FreeMem(tPointer, Length(FindText) + 1);
      FreeMem(Buffer,BuffLength);
      Memo1.SetFocus; //This line highlight the found text
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  FindDialog1.Execute;
end;

Best regards
Mohammed Nasman
0
 

Author Comment

by:syloux
ID: 6334559

I should be more specific the first time :)

I have a paradox table with a memo.  I need to find records containing a certain text in the memo.
I'm using a OnFilterRecord to do that.

Procedure TDataModule1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
Begin
  Accept := Pos('Hello world', Table1.Memo.Text) ;
End ;

But it do not work.  I have an error message telling the memo can not be access in a filter.
How can I do that ???

Thank you.
0
 
LVL 6

Expert Comment

by:edey
ID: 6335149
How about putting a (hidden, visible := false) TDBRichEdit on a form, iterate through each DB record
calling DBRichEdit1.findText(some_string_to_search_for) until you hit it.

GL
Mike
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8734884
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To be PAQ/Refund

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0
 

Accepted Solution

by:
RotaredoM earned 0 total points
ID: 8822570
Finalized as recommended.

Question PAQed and 50 points refunded.

RotaredoM
CS Mod @ EE
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 157
how to update exe applicatio from internet ? 6 78
How to convert memory stream to PDF file 6 58
DBGrid or StringGrid ? 6 89
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question