Solved

Delphi Programming question

Posted on 1997-09-12
3
182 Views
Last Modified: 2010-04-04
How can I search for a word in a Paradox Memo or Formatted Memo?
0
Comment
Question by:rainbowsoftware
[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
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 20 total points
ID: 1344716
try this one, it's case sensitive:

procedure TForm1.Button1Click(Sender: TObject);
var FText: string;
size: integer;
Buffer, FindBuf: PChar;
A: array[0..255] of char;
begin
  if InputQuery('Find Text', 'Enter text to find:', FText) then
  with memo1 do begin
    setfocus;
    size:=gettextlen+1;
    GetMem(Buffer,Size);
    GetTextBuf(Buffer,Size);
    FindBuf:=StrPos(Buffer,strPCopy(A,FText));
    if FindBuf<>nil then
    begin
      selstart:=Size-StrLen(FindBuf)-1;
      sellength:=length(FText);
    end
    else
      showmessage('not found');
    FreeMem(Buffer,Size);
  end;
end;

0
 

Author Comment

by:rainbowsoftware
ID: 1344717
This is a good code, but maybe I should learn to write exactly what I want to do. I want to search for 2 or more different words in a memo and in case not sensitive.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1344718
1. to make the search in case not sensitive write:
   FindBuf:=StrPos(strupper(Buffer),strupper(strPCopy(A,FText)));
   instead of
   FindBuf:=StrPos(Buffer,strPCopy(A,FText));
2. to find 2 words or more expand this basic procedure for your       own needs, say run this procedure a number of times as the       number of words you need to find.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

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