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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:41:06+00:00 2026-05-30T23:41:06+00:00

I have a winforms application that has one tabcontrol with 2 pages. On both

  • 0

I have a winforms application that has one tabcontrol with 2 pages.

On both pages I have data that is displayed in a datagridview called TaskTable. The data is displayed from TaskDataSet which is bound to an XML file.

However, at the moment the only way of displaying the data is to click the Read XML button so when the either of the pages are first clicked the datagridview is empty which I don’t like.

When the either of the pages are clicked I want the datagridview to automatically fill.

Any ideas how to do this:

Here is my code for the Read XML button if that helps:

private void ReadXmlButton_Click(object sender, EventArgs e) // event handler to display saved tasks.
    {

        if (TaskTable.Rows.Count == 0)
        {
            DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn(); // checkbox column = 'column'

            {
                column.HeaderText = "Complete";
                column.Name = "Complete";
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                column.FlatStyle = FlatStyle.Standard;
                column.ThreeState = false;
                column.CellTemplate = new DataGridViewCheckBoxCell();
                column.CellTemplate.Style.BackColor = Color.White;
                column.CellTemplate.Style.ForeColor = Color.Green;
            }

            TaskTable.Columns.Insert(0, column); // Column of checkboxes.

            TaskDataSet.Clear(); // Clears dataset
            TaskDataSet.ReadXml(fileURL);
            TaskTable.DataSource = TaskDataSet;
            TaskTable.DataMember = "Task";
            TaskTable.Columns[5].Visible = false; // hides numeric priority - only used for sorting
        }
        else
        {
            TaskDataSet.Clear(); // Clears dataset
            TaskDataSet.ReadXml(fileURL); // reads xml to retrieve any additional tasks that have been added to the XML file.                      
            TaskTable.DataSource = TaskDataSet;
            TaskTable.DataMember = "Task";
            TaskTable.Columns[5].Visible = false; // hides numeric priority - only used for sorting
        }

    }

Any help would be greatly appreciated!

  • 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-30T23:41:07+00:00Added an answer on May 30, 2026 at 11:41 pm

    Quick google search shows that the TabControl raises a number of events – the following probably being the most appropriate:
    http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.selected.aspx

    hook up to that event and load your xml.

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

Sidebar

Related Questions

I have a .net WinForms 2.0 application that has an image library of about
I have a TreeView control in my WinForms .NET application that has multiple levels
I have C# winforms application that needs to start an external exe from time
We have a WinForms application that uses SQL server to store its data. To
One of our clients has an old WinForms application that contains forms with a
This application has a WCF web service that is called by a WinForms app.
i have a winforms applicatoin that has a lot of implementations of IOrderDataLoader. Other
I have a winforms application that normally is at about 2-4% CPU. We are
I have a winforms application that presently ships with a chm file for context-sensitive
I have a winforms application that is doing the following: on each query: Db

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.