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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:38:33+00:00 2026-05-24T17:38:33+00:00

well I have a datagridview , and i have a column, all i want

  • 0

well I have a datagridview , and i have a column, all i want to do is controlling the cells in this column, sometimes make it combobox, sometimes textBox ….etc

I can make the cells of a column have only one type , can i make many cells type in one column ?

hope it is clear .

  • 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-24T17:38:34+00:00Added an answer on May 24, 2026 at 5:38 pm

    There are two ways to do this:

    1. Cast a DataGridViewCell to a certain cell type that exists. For example, convert a DataGridViewTextBoxCell to DataGridViewComboBoxCell type.
    2. Create a control and add it into the controls collection of DataGridView, set its location and size to fit the cell that to be host.

    See my sample code below which illustrates the tricks.

    private void Form5_Load(object sender, EventArgs e)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("name");
                for (int j = 0; j < 10; j++)
                {
                    dt.Rows.Add("");
                }
                this.dataGridView1.DataSource = dt;
                this.dataGridView1.Columns[0].Width = 200;
    
                /*
                 * First method : Convert to an existed cell type such ComboBox cell,etc
                 */
    
                DataGridViewComboBoxCell ComboBoxCell = new DataGridViewComboBoxCell();
                ComboBoxCell.Items.AddRange(new string[] { "aaa","bbb","ccc" });
                this.dataGridView1[0, 0] = ComboBoxCell;
                this.dataGridView1[0, 0].Value = "bbb";
    
                DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
                this.dataGridView1[0, 1] = TextBoxCell;
                this.dataGridView1[0, 1].Value = "some text";
    
                DataGridViewCheckBoxCell CheckBoxCell = new DataGridViewCheckBoxCell();
                CheckBoxCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                this.dataGridView1[0, 2] = CheckBoxCell;
                this.dataGridView1[0, 2].Value = true;
    
                /*
                 * Second method : Add control to the host in the cell
                 */
                DateTimePicker dtp = new DateTimePicker();
                dtp.Value = DateTime.Now.AddDays(-10);
                //add DateTimePicker into the control collection of the DataGridView
                this.dataGridView1.Controls.Add(dtp);
                //set its location and size to fit the cell
                dtp.Location = this.dataGridView1.GetCellDisplayRectangle(0, 3,true).Location;
                dtp.Size = this.dataGridView1.GetCellDisplayRectangle(0, 3,true).Size;
            }
    

    Taken from here

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

Sidebar

Related Questions

I have one DataGridView and want to make the Header text Bold. I have
well i have a configuration like this in the components part of my config
Well i have a div tag that i show as a modal dialog this
Well I have been writing in the same style for awhile now and all
I have a DataGridView that uses databinding, with manually created columns, and this works
I have a datagridview in which I want to copy some rows to a
Possible Duplicate: Direct access to DataGridView combobox in one click? I'm sure this behavior
I have a datagrid view like this....in below image well thats works fine... I
This question may well have been asked before but I didn't find anything whilst
I have a DataGridView in C# (.NET 2.0) with a few read-only cells (3

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.