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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:35:57+00:00 2026-05-27T20:35:57+00:00

I am trying to have 2 check boxes in rows from first 2 columns

  • 0

I am trying to have 2 check boxes in rows from first 2 columns and rest with some text. With my code I have the text boxes at each row but at the last 2 columns.

I want to be able to put my check boxes before the text entries.

I tried changing order of the code but I cannot get the result I desire.

What could be wrong with my code here?

        dataGridView1.ColumnCount = 4;
        dataGridView1.Columns[0].Name = "Delete";
        dataGridView1.Columns[1].Name = "Edit";
        dataGridView1.Columns[2].Name = "User Name";
        dataGridView1.Columns[3].Name = "Password";

        DataGridViewCheckBoxColumn delete = new DataGridViewCheckBoxColumn();
        DataGridViewCheckBoxColumn edit = new DataGridViewCheckBoxColumn();
        dataGridView1.Columns.Add(delete);
        delete.HeaderText = "Delete";
        dataGridView1.Columns.Add(edit);
        edit.HeaderText = "Edit";

        string[] row;

        row = new string[] { "1", "Product 1", "1000", "1" };
        dataGridView1.Rows.Add(row);
        row = new string[] { "2", "Product 4", "2000", "2" };
        dataGridView1.Rows.Add(row);
        row = new string[] { "3", "Product 5", "3000", "3" };
        dataGridView1.Rows.Add(row);
        row = new string[] { "4", "Product 6", "4000", "4" };
        dataGridView1.Rows.Add(row);
  • 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-27T20:35:58+00:00Added an answer on May 27, 2026 at 8:35 pm

    The DataGridView.Rows.Add() function takes an array of objects. The object type you provide should depend on the type of each column.

    Therefore, if you set up your columns properly, you should be able to write:

    dataGridView1.Rows.Add(new object[] { true, false, "user", "password" });
    

    In your original code you added the columns twice in two different ways. Pick one method of adding the columns.

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

Sidebar

Related Questions

I have 3 check boxes in each row of 8 total rows. I want
I'm trying to check out files from our CVS Repository (I have access, but
I have multiple check boxes from a many to many relationship, And i'm trying
I am trying to delete multiple records using check boxes. I've loaded each check
I have a datagrid with 5 columns. The first column has checkboxs and rest
I'm trying to setup custom validation for a checkbox. I have 7 checkboxes each
I have been trying to check my arraylist to see if an object already
I have been trying to check whether an NSInteger is odd or even. I
I have been trying for quite a while to check if submitted links are
I am trying to check if I have write access to a specific key

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.