?
Solved

Search string in a Memo

Posted on 2001-07-27
8
Medium Priority
?
258 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
Independent Software Vendors: 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 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