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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:58:21+00:00 2026-05-25T22:58:21+00:00

I am building a program that loads an xml to a datagridview, But I

  • 0

I am building a program that loads an xml to a datagridview,

But I need to add 2 more columns one with buttons and one with images.

How can I add them here: ?

     DataSet data = new DataSet(); string p = System.IO.Path.Combine(Application.StartupPath, "payday.xml");
                    data.ReadXml(p);
                    this.dataGrid.DataSource = data;
                    this.dataGrid.DataMember = "costumer";
                    int i = 0;
                    foreach (DataGridViewColumn column in this.dataGrid.Columns)
                    {
                        if (column.Name == "Name" || column.Name == "Status" || column.Name == "URL" || column.Name == "type" || column.Name == "Last-Checked-Pay")
                        {
                            column.Visible = true;
                            column.Width = (int)(dataGrid.Width * .2) + (column.Name.Length / 2);
                        }
                        else
                        {
                            //I tried to do it here:
                            //dataGrid.Columns[i+1].CellType = new DataGridViewButtonColumn();
                            //dataGrid.Columns[i+1].HeaderCell.
                        }
                        i++;
                    }
  • 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-25T22:58:22+00:00Added an answer on May 25, 2026 at 10:58 pm

    This will help with adding to the column collection (although you can shorthand the add by implicitly adding to the collection using Add on the DataGridView). As far as adding data goes, you will likely want to add using the row binding event so you can populate those columns.

    The other option is add the information needed to the dataset and then bind the newly added columns (fields).

    The first option dinks with the DataGridView programatically, while the second allows you to add a declarative set up for the DataGridView and massages the data that is bound.

    Which to choose? If the DataGridView always has these fields, I would massage the data. If the added columns only appear some of the time, I would alter the DataGridView programmatically.

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

Sidebar

Related Questions

I'm building a program that communicates with Emacs, and one of the challenges I'm
I'm building a program that has several functions that need to read data from
I'm building a program that does network acceleration, and I need to know how
I'm building a program that parses a website and store links and images, i'm
I'm building a graphical program that will need to show files on both the
I am building a program that takes an input file in this format: title
I am building a C# program that unzips a file, and work on this
I'm building a application that sends a test message to another email, the program
Im building a Reversi program and i need to delay the program for something
I am building a time registration program. Users can work on a project, and

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.