473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
1 3516
Rabbit
12,516 Expert Mod 8TB
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

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

Similar topics

1
by: Das | last post by:
Hi, I want to display row header column into the row header column of the datagrid. How to set that column with the current row number Thanks in advance.. Regards, das
5
by: Stan | last post by:
I would like my header column span multiple columns, for example: Date Ready Open Close --------------------------- 08/06 10 am 5pm How can I do that? Thanks,
1
by: Patrick B. | last post by:
How do I get the bounding rectangle of the row header column of the DataGrid control? I have tried using the GetCellBounds with a column value of -1 but an exception is thrown with an "out of...
2
by: Li Pang | last post by:
Hi, I used some code to add an arrow icon onto a listview header column for the sorting purpose. However, after the icon added, the TextAlign of the column becomes "left", if I enforced...
0
by: vinaykumar Maladkar | last post by:
Hi All, I m using Visual studio 2005 and C#. i want to show comparative data of different cars like their price , engine , capacity etc. So i am using DataGridView. but How to group one or more...
4
by: TS | last post by:
I have a headerText for a header column that is "Page<br>Name". it puts a <brto force a line break, but the < and get encoded to &lt; and &gt; thus negating its effect as an html control and doesn't...
1
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I've a column in a dataGridView set as combobox. I can't find any example showing how to populate the list in the combobox. Does anyone have an example showing me this. Regards Jesper.
3
by: minhtran | last post by:
Hi all Anyone has any idea how to get a Excel header column in VB.NET. Please, help me. Thank you so much in advance
4
by: Bluberiman | last post by:
I have a couple of combobox in a datagridview control (winform) 1-I select a new value. 2-I click elsewhere on the form (out of any controls OR out of any cells but inside the DGV control) If...
0
by: Moorthi chinna | last post by:
how to reload combobox in datagridview based on combobox selection in datagridview?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.