Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

How do I search a MemoBox(C++)?

  • 14-04-2003 12:51PM
    #1
    Closed Accounts Posts: 6


    Hi all,

    Can anyone tell me how to find an item in a MemoBox.

    if (Form3->Memo1->SelText == "<First Name>"){
    Memo1->SelText = first_name;
    }

    I want to find <First Name> in the MemoBox and replace it with the variable first_name.

    Do I need something called Lines or LineCount to search the memobox and find the text(First Name)?

    Any help would be appreciated.
    clarabell


Comments

  • Registered Users, Registered Users 2 Posts: 2,157 ✭✭✭dazberry


    Originally posted by clarabell

    I want to find <First Name> in the MemoBox and replace it with the variable first_name.

    Do I need something called Lines or LineCount to search the memobox and find the text(First Name)?

    The Lines property is of type TStrings, so you use it like you'd use any TString derived class. In this case either (in Delphi)

    {search each line}
    for nLoop:=0 to Memo1.Lines.Count-1 do
    if pos('<First Name>',Memo1.Lines[nLoop]) > 0 then

    or

    {search the complete text}
    Pos('<FirstName>',Memo1.Lines.Text)

    Note: Memo1.Lines[index] is the same as Memo1.Lines.Strings[index].

    Disclaimer: Pos is a Delphi function, I'd guess its available in BCB but I could be wrong.

    D.


Advertisement