How to query a RichEdit and put the query results in another RichEdit,

Source: Internet
Author: User
How to query a RichEdit and put the query results in another RichEdit, Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061209085300216.html
There are two RichEdit controls. the received data is displayed in richedit1, and each data is separated by a carriage return. You need to query richedit1 and display the query results in richedit2, I want to know how to use it.

The query conditions are not clearly stated in the question. How can I write a query for you? What are the results?
Do not "understand yourself", or "Ask questions ".
---- It may be sharp and acceptable.

For example, the ricdedit1 control has

001 name: Zhang San age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)

002 name: Li Si age: 21 Gender: Female remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)

003 name: Wang Wu age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)
///////////////

To implement a query, for example, querying "male", the query result is displayed in richedit2. The display format is as follows:

//////////////

001 name: Zhang San age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)

003 name: Wang Wu age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)

procedure tform1.button2click (Sender: tobject);
var
I: integer;
begin
edit1.text: = 'male '; // The reason why 'gender: Male' is used as the query condition is to prevent other locations such as names from having the word 'male'
for I: = 0 to richedit1.lines. count-1 do
If pos ('gender: '+ edit1.text, richedit1.lines [I])> 0 then
richedit2.lines. add (richedit1.lines [I]);
end;
// It seems that RichEdit is not a strong expert in processing such data.

controls such as grid can be used. However, you may have special needs. The Code above can meet your needs. You can modify the value of ('gender: '+ edit1.text) according to different conditions. For example, use checkbox to determine whether the query is by name or gender... to query the name, you can:
var substr: string;
.....
If checkboxxingming. checked then substr: = 'name: '+ edit1.text;
.....
If pos (substr, richedit1.lines [I])> 0 then ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.