CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Posts
    7

    Help with sorting and filtering the contents of a rich text box

    Hello,

    I have a rich text box, and want to filter the contents of this rich text box into another rich text box.

    Initially, the contents of the first rich text box are loaded by the file reader of openfiledialog. This means they are in memory.

    How do I go about sorting and filtering the content?

    Basically, my first rich text box has a loaded file consiting of:

    MODEL 1
    ATOM 1 N GLY A 1 296.995 21.768 -6.913 1.00 0.00 N
    ATOM 2 CA GLY A 1 296.814 21.433 -8.356 1.00 0.00 C
    ATOM 3 C GLY A 1 295.982 20.178 -8.579 1.00 0.00 C
    ATOM 4 O GLY A 1 295.381 19.654 -7.643 1.00 0.00 O
    ATOM 5 HA2 GLY A 1 296.321 22.263 -8.844 1.00 0.00 H
    ATOM 6 HA3 GLY A 1 297.784 21.294 -8.810 1.00 0.00 H
    ATOM 7 H1 GLY A 1 297.491 22.677 -6.814 1.00 0.00 H
    ATOM 8 H2 GLY A 1 297.556 21.035 -6.439 1.00 0.00 H
    ATOM 9 H3 GLY A 1 296.072 21.842 -6.444 1.00 0.00 H
    ATOM 10 N PRO A 2 295.945 19.670 -9.815 1.00 0.00 N
    ATOM 11 CA PRO A 2 295.156 18.482 -10.172 1.00 0.00 C
    ATOM 12 C PRO A 2 295.508 17.239 -9.360 1.00 0.00 C

    etc...

    And I need to sort and filter so that the output looks like this:

    >Chain_A
    1 - GLY PRO ASN THR GLU PHE ALA LEU SER LEU LEU ARG LYS ASN ILE MET THR ILE THR THR SER LYS GLY GLU PHE THR GLY LEU GLY ILE HIS ASP ARG VAL CYS VAL ILE PRO THR HIS ALA GLN PRO GLY ASP ASP VAL LEU VAL ASN
    51 - GLY GLN LYS ILE ARG VAL LYS ASP LYS TYR LYS LEU VAL ASP PRO GLU ASN ILE ASN LEU GLU LEU THR VAL LEU THR LEU ASP ARG ASN GLU LYS PHE ARG ASP ILE ARG GLY PHE ILE SER GLU ASP LEU GLU GLY VAL ASP ALA THR
    101 - LEU VAL VAL HIS SER ASN ASN PHE THR ASN THR ILE LEU GLU VAL GLY PRO VAL THR MET ALA GLY LEU ILE ASN LEU SER SER THR PRO THR ASN ARG MET ILE ARG TYR ASP TYR ALA THR LYS THR GLY GLN CYS GLY GLY VAL LEU
    151 - CYS ALA THR GLY LYS ILE PHE GLY ILE HIS VAL GLY GLY ASN GLY ARG GLN GLY PHE SER ALA GLN LEU LYS LYS GLN TYR PHE VAL GLU LYS GLN

    >Chain_B
    1 - LEU GLU ALA LEU PHE GLN

    Would this be able to be done from a rich text box, or is it best to use something else?

    Thank-you,

    Kind Regards,

    Timothy Johansen.

  2. #2
    Join Date
    Dec 2009
    Posts
    7

    Re: Help with sorting and filtering the contents of a rich text box

    Additional** Ignore chain B, all I need is the element number, and the associated element.

  3. #3
    Join Date
    Dec 2009
    Posts
    7

    Re: Help with sorting and filtering the contents of a rich text box

    Here are the files to look at (just the pogramme)
    Attached Files Attached Files

  4. #4
    Join Date
    Apr 2004
    Posts
    102

    Re: Help with sorting and filtering the contents of a rich text box

    Would this be able to be done from a rich text box, or is it best to use something else?
    IMO, I'd write a separate function to sort and filter what is found in the first rich text box and then write the sorted/filtered text to the second rich text box.

    Maybe I'm missing something in your post but I don't see the "sort and filter" relationship between what you have in MODEL 1 and the end result in Chain_A.

  5. #5
    Join Date
    Sep 2006
    Posts
    31

    Re: Help with sorting and filtering the contents of a rich text box

    I made a solution in your other thread
    http://www.codeguru.com/forum/showthread.php?t=489660

    kristof

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured