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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:52:59+00:00 2026-05-27T23:52:59+00:00

I have a datagridviewcell with textbox as the control hosted by it. Now how

  • 0

I have a datagridviewcell with textbox as the control hosted by it. Now how do I get the type of control programmatically in other parts of my code?

I add the column like this:

DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
col.ReadOnly = false;
col.Name = "Status";
col.HeaderText = "Status";
dgv.Columns.Add(col);

All the cells in that column now will have a textbox. I can get the control as a textbox like this:

private void dgv_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
    if (dgv.CurrentCell.ColumnIndex == 5 && e.Control is TextBox)
    {
         //something
    }
}

How do I get the type of control hosted in the cell elsewhere? How to get e.Control from other parts of code so that I can do things like:

((TextBox)dgv[i, j].EditinControl).AutoCompleteSource = AutoCompleteSource.CustomSource;
((TextBox)dgv[i, j].EditinControl).AutoCompleteCustomSource = someSource;
((TextBox)dgv[i, j].EditinControl).AutoCompleteMode = AutoCompleteMode.SuggestAppend;

etc. What can substitute for EditinControl in the above line.. ??

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

    I don’t think you can access the editing control of a cell unless that cell is in edit mode. I think the cell doesn’t have an edit control until it enters edit mode. This is probably why there is no EditingControl property on the cell, but there is one the DataGridView.

    You can get the type of editing control of a cell using the EditType property of the cell, and you can get the current edit control with the DataGridView.EditingControl property.

    if (dgv.CurrentCell.EditType == typeof(DataGridViewTextBoxEditingControl))     
    {         
        ((TextBox)dgv.EditingControl).AutoCompleteSource =
            AutoCompleteSource.CustomSource; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom DataGridViewCell with a user-control as its editing control. The cell
I have the following cell which is used for my custom column data type
Have just started using Google Chrome , and noticed in parts of our site,
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have a problem with my custom DataGridViewCell, indeed i tried to write to
I have a DataGridView that is bound to a DataTable, it has a column
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm
I have a control which extends the DataGridView control. I am overriding the ProcessDialyKey

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.