Solved

Search string in a Memo

Posted on 2001-07-27
8
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 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