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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:36:45+00:00 2026-06-13T01:36:45+00:00

I have a datagridview which is populated from a dataset. Once it is populated,

  • 0

I have a datagridview which is populated from a dataset.

Once it is populated, if the user clicks on a row, the last column should change from textbox to combobox.

I am using vb.net 2010.

On the Datagridview1 CellClick event:

    With DataGridView1
        If .Rows.Count = 0 Then Exit Sub
        i = Datagridview1.currentrow.index

        Dim gridComboBox As New DataGridViewComboBoxCell
        gridComboBox.Items.Add("A") 'Populate the Combobox
        gridComboBox.Items.Add("B") 'Populate the Combobox
        gridComboBox.Items.Add("C") 'Populate the Combobox
        .Item(8, i) = gridComboBox
    End With

But this results in an error:

The following exception occurred in DataGridView:
System.Argument.Exception: DataGridViewComboBoxCell value is not valid.
To replace this default dialog please handle the DataError event.

If the situation is not feasible, I want the last column to be of type combobox upon populate of data from the dataset.

DataGridView1.DataSource = myDataSet

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-13T01:36:46+00:00Added an answer on June 13, 2026 at 1:36 am

    Alright, this is my conclusion from a bit of testing.
    Your code works as long as the value of the cell is the same as one of the drop down alternatives. But if the cell value where you put the combobox is “D” (cmbbox only has “A”, “B” and “C”) you will get this error message.

    So either you put in the current value as an option in your combobox, make sure that the cell only can have A,B or C as value or simply just clear the cell by setting its value to “”. Then this will work. 🙂

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

Sidebar

Related Questions

I have a datagridview and a combobox which get populated randomly with data. However,
I have a datagridview which is editable. I have a textbox below it. I
I have a DataGridView which is filling from Table in SQL Server Database. One
I have a datagridview in which one column contains a custom class, which I
I have a datagridview column 'total',in which I am doing sum of rates of
I have a nice litte DataGridView, which gets loaded/populated by a button and a
I have a DataGridView on my Form which is being populated with database records
I have a DataTable, fully populated, which I want to set to a DatagridView:
I have a DataGridView which I am populating from a list of objects. However
I have a DataTable which is populated from a CSV file then, using a

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.