By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

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

P: 1
Expand|Select|Wrap|Line Numbers
  1. Private Sub DGVColumnHeader_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Me.DataGridView1.DataSource = Me.bs
  3.         Dim i As Integer = -1
  4. DataGridView1.Columns.Add("Name", "Product Name")
  5.         DataGridView1.Columns.Add("Description", "Description")
  6.         DataGridView1.Columns.Add("Price", "Price")
  7.         '---create a new bindingsource control---
  8.         Dim bindingsource As New BindingSource
  9.         '---add the items into the control---
  10.         bindingsource.Add("Type A")
  11.         bindingsource.Add("Type B")
  12.         bindingsource.Add("Type C")
  13. Dim myDataGridViewComboBox As New DataGridViewComboBoxCell
  14.         myDataGridViewComboBox.Items.Add("Item 1")
  15.         myDataGridViewComboBox.Items.Add("Item 2")
  16.         myDataGridViewComboBox.Items.Add("Item 3")
  17.         'Me.DataGridView1(-1,1)=myDataGridViewComboBox//errorIndex was out of range. Must be non-negative and less than the size of the collection.
  18. Parameter name: index
Feb 18 '13 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,383
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?
Feb 18 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.