Click here to Skip to main content
14,865,522 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am using this code for displaying the contents paragraph by paragraph but i want to display from a particular...that means i want to delete the previous paragraphs...

VB
 For Each p In currentDocument.Paragraphs
                       If p.range.text.Trim().Length <> 0 Then
               list.Add(p.range.text)
           End If
       Next p 
currentIndex = currentIndex + 1
        TextBox1.Text = list(currentIndex)


so now i want to delete the paragraphs up to a particular paragraph..

Thanks in advance....
Posted
Updated 30-Aug-12 4:29am
v2

1 solution

Are you able to identify the paragraph beyond which you want to add to the listbox? If yes, just check for that condition in the paragraph text. You can then add all paragraphs that have an index greater than this boundary paragraph.

HTH
   
Comments
vinay597 30-Aug-12 10:22am
   
i identified the index but i want to delete with the help of a text....which comes up to a particular paragraph
ChandraRam 30-Aug-12 10:24am
   
If you delete the paragraph, it is going to remove it from the document - do you want that? Or do you want to just not add it to the list box?
vinay597 30-Aug-12 10:35am
   
i just want to delete it from adding into the list
ChandraRam 30-Aug-12 10:37am
   
Set a flag when you reach the text that you are looking for, and add to the list only when the flag is true.
vinay597 30-Aug-12 10:40am
   
can you post the code please
ChandraRam 30-Aug-12 10:42am
   
I don't think so :) I have given you enough information to try it out on your own... do that, and then if you get stuck, post what you have done and I will help you further.
vinay597 30-Aug-12 10:45am
   
okay i will try it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900