Solved

Search string in a Memo

Posted on 2001-07-27
8
253 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] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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