Solved

Search string in a Memo

Posted on 2001-07-27
8
240 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
 
LVL 22

Expert Comment

by:mnasman
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now