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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:38:56+00:00 2026-06-09T14:38:56+00:00

I have a unbound DataGridView with two columns. First column is just string values.

  • 0

I have a unbound DataGridView with two columns. First column is just string values.
Second column I want to display a combobox, only when user click the cell(not the whole column as DataGridViewColumn). I use the below code which is incorrect and gives me the error : Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
The first column is popuated, and the second column is empty.

The code is as below :

Private Sub DGVFieldsMap_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVFieldsMap.CellEnter
    If e.ColumnIndex = 1 Then
        If cboClmCell Is Nothing Then
            Dim dgv As DataGridView = CType(sender, DataGridView)
            cboClmCell = New DataGridViewComboBoxCell
            cboClmCell.Items.Add("A")
            cboClmCell.Items.Add("B")
            cboClmCell.Items.Add("C")
            cboClmCell.Items.Add("D")
            cboClmCell.Items.Add("E")
            cboClmCell.Items.Add("F")
            dgv.Focus()
            dgv(e.ColumnIndex, e.RowIndex) = cboClmCell '[Error Here]
            isCombo = True
        End If
    End If
End Sub


Private Sub DGVFieldsMap_CellValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles DGVFieldsMap.CellValidating
        If e.ColumnIndex = 1 Then
            Dim dgv As DataGridView = CType(sender, DataGridView)
            If isCombo Then
                isCombo = False
                cboClmCell = Nothing
                dgv(e.ColumnIndex, e.RowIndex) = New DataGridViewTextBoxCell()
            End If
        End If
End Sub

Can anybody give me a complete working example with two columns, the second column being a ComboBoxCell, but only when user clicks. Also I need to get the selected values in the DataGridView cell. Thanks In Advance.

  • 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-06-09T14:38:58+00:00Added an answer on June 9, 2026 at 2:38 pm

    Don’t try to replace the columns in event handlers, instead create a DataGridView with 2 columns, have the 2nd column be your DataGridViewComboBoxColumn. There is a property on that column called “DisplayStyle” which determines how the column looks when not editing. Set it to “Nothing”. Now it will look like a textbox until you go into edit mode at which point it looks like a combobox.

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

Sidebar

Related Questions

I have few columns in my DataGridView, one of them is an unbound column
On a Windows form I have an unbound datagridview with 1 user-editable column. A
I have a form created which an unbound datagridview that has three columns. Position,
I have an unbound datagridview with 175 columns and 50,000 rows, populated primarily with
I have an unbound datagridview view. The first load always runs very fast but
I have a DataGridView in a Winforms app that has about 1000 rows (unbound)
I'm using c#2.0 and WinForms. I have a datagridview control, unbound, loading small amounts
Referring to the first answer about python's bound and unbound methods here, I have
I have a datagridview (unbound). Fields are Name, Family Name and Phone No and
I am using 3 unbound DataGridView controls to display certain information. To load the

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.