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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:53:29+00:00 2026-05-12T19:53:29+00:00

I have a form with a DataGridView and I want to load data from

  • 0

I have a form with a DataGridView and I want to load data from an XML file into the Grid using a DataSet. I create a DataSet, load the XML into the DataSet, then assign the DataSet to the DataSource property of the Grid:

private void formAccountHistory_Load(object sender, EventArgs e)
{
    // Load the DataSet that represents the offline version of the database.
    AccountHistoryDS = new DataSet("TicketAccountHistory");

    AccountHistoryDS.ReadXmlSchema("TicketsAccountHistory.xsd");
    AccountHistoryDS.ReadXml("TicketsAccountHistory.xml", XmlReadMode.Auto);
    AccountHistoryDS.Locale = System.Globalization.CultureInfo.CurrentUICulture;

    dataGridViewStatement.AutoGenerateColumns = false;
    dataGridViewStatement.DataSource = AccountHistoryDS;
    dataGridViewStatement.DataMember = "Line";
}

However the data doesn’t display in the Grid. I have 8 rows in the XML file and the Grid creates 8 rows alright but they are all blank. When I debug the code I can see the data in the DataSet so it seems to be loading it correctly to that point, just not displaying it in in the Grid. The XML file I use is below – it is well formed and validates against its schema:

<?xml version="1.0" standalone="yes"?>
<TicketsAccountHistory>
    <Line>
        <colID>03/09</colID>
        <colStartEnd>14/01/2009-20/01/2009</colStartEnd>
        <colDate>14/01/2009</colDate>
        <colType>Period 03/09 - opening balance</colType>
        <colDR></colDR>
        <colCR></colCR>
        <colBalance>0.00</colBalance>
    </Line>
    <Line>
        <colID>03/09</colID>
        <colStartEnd>14/01/2009-20/01/2009</colStartEnd>
        <colDate>20/01/2009</colDate>
        <colType>Sales Invoice (Ref: MRO-S-03/09)</colType>
        <colDR>1000</colDR>
        <colCR></colCR>
        <colBalance>1000.00</colBalance>
    </Line>
    <Line>
        <colID>03/09</colID>
        <colStartEnd>14/01/2009-20/01/2009</colStartEnd>
        <colDate>20/01/2009</colDate>
        <colType>Commission Invoice (Ref: MRO-C-03/09)</colType>
        <colDR></colDR>
        <colCR>100.00</colCR>
        <colBalance>900.00</colBalance>
    </Line>
    <!-- 5 more rows similar to this -->
</TicketsAccountHistory>

Can anyone tell me what I might be doing wrong? I’m new to .NET 3.5 and the DataGridView and I don’t know how what events are fired when a Grid is populated, if there should be code in any of those events, etc. Any help appreciated.

Cheers,
Ciaran.

  • 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-12T19:53:29+00:00Added an answer on May 12, 2026 at 7:53 pm

    You’ve got the statement:

     dataGridViewStatement.AutoGenerateColumns = false;
    

    This means that the DataGridView won’t have any columns. Either set it to true or insert some code to add the columns.

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

Sidebar

Related Questions

I have form area in my view. If I click button A , I
I have form that displays several keywords (standard set of choice lists that changes
I have a form in C# that has a button that, when clicked, I
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
I have subclassed Form to include some extra functionality, which boils down to a
I have a form with some radio buttons that are disabled by default. When
I have a form with many input fields. When I catch the submit form
I have a form in which people will be entering dollar values. Possible inputs:
I have a form element that contains multiple lines of inputs. Think of each
( .NET 2.0, System.Windows.FormsDataGridView and DataTable ) I have 1 datagrid connected to 1

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.