Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

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

Options
  • 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 Posts: 2,149 ✭✭✭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