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

  • Home
  • SEARCH
  • 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 7650499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:16:02+00:00 2026-05-31T11:16:02+00:00

My datagrid has two textbox columns and two button column. I was trying that

  • 0

My datagrid has two textbox columns and two button column. I was trying that when user clicks on button then adjacent textbox cell will be in edit mode and cursor will be placed there.

My textbox columns are in readonly mode.

So I wrote code in cell enter that

private void dgView_CellEnter(object sender, DataGridViewCellEventArgs e)
    {
        if (e.RowIndex == 2)
        {
            DataGridView dgv = (DataGridView)sender;
            DataGridViewTextBoxCell textBoxCell = dgv.CurrentCell as DataGridViewTextBoxCell;
            if (textBoxCell != null)
            {
                dgv.BeginEdit(true);
            }
        }
    }

I am not getting error but my objective is not fulfill. Textbox cell is not getting in edit mode and cursor is not being placed on the textbox cell. So please tell me and rectify my code as result when I will click on button then adjacent textbox cell will come in edit mode and cursor will blink there.

  • 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-31T11:16:03+00:00Added an answer on May 31, 2026 at 11:16 am

    Try using the CellClick event. You don’t really need to call Focus() just set the CurrentCell and BeginEdit:

    private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) {
            if (e.RowIndex == 2) {
                DataGridView dgv = (DataGridView)sender;
                DataGridViewCell textBoxCell = dgv.Rows[e.RowIndex].Cells[col_index];
                if (textBoxCell != null) {
                    dataGridView1.CurrentCell = textBoxCell;
                    dgv.BeginEdit(true);
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code working with a DataGrid that has two column Column_A
I have a SL DataGrid that has two columns. I need to be able
I have a datagrid that has two columns. The DataSource for the datagrid is
I have a DataGrid component that displays a few columns of data. It has
I have a form that consists of two data grids and a button. Datagrid
I have a wpf datagrid that has it's columns generated dynamically in code and
I have a WPF Datagrid with a Text Column, two Template Columns, and two
I have a datagrid with 5 columns. The first column has checkboxs and rest
I've got a dynamically filled datagrid view. When a user right clicks a cell
I have a page (below) that has a datagrid that lists item's returned from

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.