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 7885871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:10:50+00:00 2026-06-03T05:10:50+00:00

As a beginner at c#, i am running against a wall with the following:

  • 0

As a beginner at c#, i am running against a wall with the following:

Basically, the object of this is to try to read information about classes-formatted in xml, into a table (listbox)… This is not happenning.

So, Im trying to read xml and append string builder to print to listbox per line.

instead the same statement is pritned on 1713 lines. Here is the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace StartProgram
{
    public partial class ModuleSummary : Form
    {
        public ModuleSummary()
        {
            InitializeComponent();
            XmlTextReader moduleReader = new XmlTextReader("c:\\users\\w1283057\\documents\\visual studio 2010\\Projects\\StartProgram\\StartProgram\\myCourses.xml");
            //to revise...

            System.Text.StringBuilder moduleEntry = new System.Text.StringBuilder();
            while(moduleReader.Read())
            {
                if ((moduleReader.NodeType == XmlNodeType.Element) && (moduleReader.Name == "moduleCode"))
                    {                        
                        moduleEntry.Append(moduleReader.ReadElementContentAsString() + " ");
                    }
                    if ((moduleReader.NodeType == XmlNodeType.Element) && (moduleReader.Name == "moduleTitle"))
                    {
                        moduleEntry.Append(moduleReader.ReadElementContentAsString() + " ");
                    }
                    if ((moduleReader.NodeType == XmlNodeType.Element) && (moduleReader.Name == "credits"))
                    {
                        moduleEntry.Append(moduleReader.ReadElementContentAsString()+" ");
                    }
                    if ((moduleReader.NodeType == XmlNodeType.Element) && (moduleReader.Name == "level"))
                    {
                        moduleEntry.Append(moduleReader.ReadElementContentAsString() + " ");
                    }
                    if ((moduleReader.NodeType == XmlNodeType.Element) && (moduleReader.Name == "semester"))
                    {
                        moduleEntry.Append(moduleReader.ReadElementContentAsString() + " test ");
                    }
                    moduleSummaryBox.Items.Add(moduleEntry);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            AddModule frm = new AddModule();
            frm.Show();
        }
    }
}
  • 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-06-03T05:10:51+00:00Added an answer on June 3, 2026 at 5:10 am

    You need to read your XML in using a XmlDocument and parse it that way. There’s plenty of tutorials online.. http://www.functionx.com/csharp2/xml/Lesson02d.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner with jdbc ... I have a problem running this code :
Please help this beginner here... I have a SQL Server 2008 R2 running on
Absolute beginner question: I have a template file index.html that looks like this: ...
I am a beginner to Android but I seem to be running across a
I am a beginner in JADE programming and I'm having problems running the JADE
I am an XML beginner, using C# .NET 2.0/Visual Studio 2005. What I have
Beginner hobby programmer here. I'm used to running C in OSX compiling with GCC
I'm a beginner in android and i tried running some code I got from
I'm about to start writing a server-side (as in not running in a browser)
The first thing is that I am a beginner. Okay? I've read related answers

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.