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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:23:13+00:00 2026-05-18T23:23:13+00:00

I am having a datagridview created as follows on button click private void button1_Click(object

  • 0

I am having a datagridview created as follows on button click

private void button1_Click(object sender, EventArgs e)
    {
        if (dataGridView1.Columns.Contains("column1") && dataGridView1.Columns.Contains("chk"))
        {

        }
        else
        {
            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
            //chk.ReadOnly = true;
            chk.Name = "chk";
            chk.DisplayIndex = 0;
            chk.Frozen = true;  
            chk.HeaderText = "check";
            dataGridView1.Columns.Add(chk);
            DataGridViewTextBoxColumn column1 = new DataGridViewTextBoxColumn();
            column1.ReadOnly = true;
            column1.Name = "column1";
            column1.HeaderText = "my column  name";
            dataGridView1.Columns.Add(column1);
            DataGridViewTextBoxColumn column2 = new DataGridViewTextBoxColumn();
            column2.ReadOnly = true;
            column2.Name = "column2";
            column2.HeaderText = "my column  name1";
            dataGridView1.Columns.Add(column2);
        }
    }

But when i click on check box a ROW is created automatically why is it happening..

  • 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-18T23:23:13+00:00Added an answer on May 18, 2026 at 11:23 pm

    this is because the property AllowUserToAddRows is true by default.

    set

    dataGridView1.AllowUserToAddRows = false;
    

    and after adding columns. add a new row to dataGridView1

    dataGridView1.Rows.Add();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble with VisualStudio 2010 C# Winforms. I have created a DataGridView
i have one datagridview.in my datagridview is having four row and three columns.after enter
I'm having some problems with a datagridview element I'm using in VS2008. This DataGridView
I'm having trouble saving a new row in the DataGridView back to the database.
I am new to programming and am having difficulty with understanding object lifetime /
I am having a datagridview where the content of that datagridview will be from
I'm having problem in my datagridview. I'm using vb 2008 and an access database.
I've a DataGridView in a winforms app. Apart from the 4 columns coming from
I'm new to using the C#/.NET programming Language and I have created a DataGridView
Having been a PHP developer on LAMP servers for quite a while, is there

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.