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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:00:06+00:00 2026-05-16T10:00:06+00:00

How to add a control in DataGridView? Using Button event. For example i want

  • 0

How to add a control in DataGridView? Using Button event. For example i want to create a new a row and column in DataGridView, this i want to happen through button control. How can i do it?
I am using C#.net and MS-Access.

  • 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-16T10:00:07+00:00Added an answer on May 16, 2026 at 10:00 am

    Here is a piece of code for adding a control into the gridview.

    private void addNewRowButton_Click(object sender, EventArgs e)
    {

           this.DataGridViewIssue.Rows.Add();//This line will add a new button contol into the grid 
       }
    
       private void deleteRowButton_Click(object sender, EventArgs e)
       {
           if (this.DataGridViewIssue.SelectedRows.Count > 0 &&
               this.DataGridViewIssue.SelectedRows[0].Index !=
               this.DataGridViewIssue.Rows.Count - 1)
           {
               this.DataGridViewIssue.Rows.RemoveAt(
                   this.DataGridViewIssue.SelectedRows[0].Index);
           }
       }
    
       private void SetupLayout()
       {
           this.Size = new Size(1055, 800);
    
           addNewRowButton.Text = "Add Row";
           addNewRowButton.Location = new Point(10, 10);
           addNewRowButton.Click += new EventHandler(addNewRowButton_Click);
    
           deleteRowButton.Text = "Delete Row";
           deleteRowButton.Location = new Point(100, 10);
           deleteRowButton.Click += new EventHandler(deleteRowButton_Click);
    
           buttonPanel.Controls.Add(addNewRowButton);
           buttonPanel.Controls.Add(deleteRowButton);
           buttonPanel.Height = 50;
           buttonPanel.Dock = DockStyle.Bottom;
    
           this.Controls.Add(this.buttonPanel);
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a control to a placeholder dynamically, like this: int fileCount
I want to add a control to a user control in an event handler
I use DataGridView, and in some places I add control to it (e.g. textbox,
I add a select control to a ASPX page like below: hgc = new
I am using WindowsFormsIntegration in a WPF project to add a DataGridView and I
I want a List<string> containing all the 'selected' series codes from this DataGridView: I
I'm catching the DataGridView control's SelectionChanged event and my event handler takes about 1/2
I am using a drop-down list in DataGridView control, but the problem is that
I am trying to add datagridview control in my custom control but i failed.
I'm developing a custom DataGridView control for internal use and I'd like to add

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.