Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3784716
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:25:09+00:00 2026-05-19T11:25:09+00:00

I am having a couple of issues with my code, I am trying to

  • 0

I am having a couple of issues with my code, I am trying to pull every paragraph from a page, but at the moment it is only selecting the last paragraph.

here is my code.

foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div[@id='body']/p"))
{
  string text = node.InnerText;
  lblTest2.Text = text;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:25:09+00:00Added an answer on May 19, 2026 at 11:25 am

    In your loop you are taking the current node innerText and assigning it to the label. You do this to each node, so of course you only see the last one – you are not preserving the previous ones.

    Try this:

    foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div[@id='body']/p"))
    {
      string text = node.InnerText;
      lblTest2.Text += text + Environment.NewLine;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the last couple months i have ben having some issues with my app.config
I've asked a couple of questions here but am still having issues. I'd appreciate
I've been making an image uploader and I'm having a couple of issues. Code
I am having a couple of issues deciding how best to describe a certain
I'm having a couple of issues which may be related, or may not. I
I'm currently trying to upgrade our build server at work, going from having no
having a couple of issues with something i thought would be easy in jquery.
I'm having some issues with Javascript content on Internet Explorer, specifically, a page will
Couple of issues here I'm not sure on what the issue is but with
I am having some frustrating javascript timing issues. FYI, the page is a jsp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.