how to add the combobox to the header column of the datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rekha Sharma
    New Member
    • Feb 2013
    • 1

    how to add the combobox to the header column of the datagridview

    Code:
    Private Sub DGVColumnHeader_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.DataGridView1.DataSource = Me.bs
            Dim i As Integer = -1
    DataGridView1.Columns.Add("Name", "Product Name")
            DataGridView1.Columns.Add("Description", "Description")
            DataGridView1.Columns.Add("Price", "Price")
            '---create a new bindingsource control---
            Dim bindingsource As New BindingSource
            '---add the items into the control---
            bindingsource.Add("Type A")
            bindingsource.Add("Type B")
            bindingsource.Add("Type C")
    Dim myDataGridViewComboBox As New DataGridViewComboBoxCell
            myDataGridViewComboBox.Items.Add("Item 1")
            myDataGridViewComboBox.Items.Add("Item 2")
            myDataGridViewComboBox.Items.Add("Item 3")
            'Me.DataGridView1(-1,1)=myDataGridViewComboBox//errorIndex was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    Last edited by Rabbit; Feb 18 '13, 07:03 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I have no idea what your question is. Your title says one thing but you post an error code that says something else. What is your actual question?

    Comment

    Working...