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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:04:36+00:00 2026-05-25T13:04:36+00:00

I have a combobox with a datagrid, but I’d like the user to be

  • 0

I have a combobox with a datagrid, but I’d like the user to be able to type into the combobox like usual; At the minute it’s a fixed dropdown. Here is my code:

  Dim NewColumn As New DataGridViewComboBoxColumn() 'Declare new DGV CC

    With NewColumn 'Set Properties
        .DataPropertyName = "NewColumn" 'Name
        .HeaderText = "New Column" 'Heading
        .DropDownWidth = 160 'Width Of DropDown Box
        .Width = 90 'Display Width
        '.MaxDropDownItems = 5 'How Many Items To Drop Down At A Time
        .FlatStyle = FlatStyle.Flat 'Appearance
        .DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox

        .Items.Add("Screw Fix 1") 'Add Some Text Items
        .Items.Add("Fix 1")
        .Items.Add("3 Stone")
        .Items.Add("34 Stone")
        .Items.Add("5")
        .Items.Add("6")
        .Items.Add("7")
        .Items.Add("8")
        .Items.Add("9")
        .Items.Add("10")
    End With
    dgDetails.Columns.Add(NewColumn) 'Add The Column
  • 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-25T13:04:37+00:00Added an answer on May 25, 2026 at 1:04 pm

    There isn’t natively you need to handle two events

    The first to allow the user to type in the new value

    Private Sub dataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles dataGridView1.EditingControlShowing
        Dim c As ComboBox = TryCast(e.Control, ComboBox)
        If c IsNot Nothing Then
            c.DropDownStyle = ComboBoxStyle.DropDown
        End If
    End Sub
    

    The second to actually insert the new value

    Private Sub dataGridView1_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) Handels dataGridView1.CellValidating
        Dim comboBoxColumn As DataGridView.Column = dataGridView1.Columns("yourColumnName")
        If e.ColumnIndex = comboBoxColumn.Index Then
            Dim eFV As Object = e.FormattedValue
            If Not comboBoxColumn.Items.Contains(eFV) Then
                comboBoxColumn.Items.Add(eFV)
                        comboBoxColumn.SelectedIndex = ComboBox.Items.Count - 1
            End If
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF toolkit DataGrid as the dropdown in a ComboBox template. <toolkit:DataGrid
The WPF datagrid -seems- like it's going to work, but the combobox implementation does
I'd like to have a combobox in a datagrid to show a list of
In a DataGrid I have a ComboBox as a field type. When I disable
i have combobox in datagrid (sourse in mysql (web)) how i can get value
I have a wpf application using caliburn.micro. It has a datagrid and a combobox.
Is there a simple example of how to have a combobox show a datagrid
I have a simple DataGrid which I want the user to add some rows
I have a SL DataGrid that has two columns. I need to be able
I have a data grid that looks like this <tk:DataGrid ItemsSource={Binding Parents} AutoGenerateColumns=False> <tk:DataGrid.Columns>

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.