Solved

VB.net Programatically add a ComboBox column

Posted on 2012-04-09
4
722 Views
Last Modified: 2012-04-09
Hi

In VB.net how do I programatically add a ComboBox column?

Thanks
0
Comment
Question by:murbro
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
ID: 37823641
Add a new column
Me.DataGridView1.Columns.Add(New DataGridViewComboBoxColumn With {.DataSource = {"First", "Second", "Third"}})

Open in new window

insert new column
Me.DataGridView1.Columns.Insert(0, New DataGridViewComboBoxColumn With {.DataSource = {"First", "Second", "Third"}})

Open in new window

0
 

Author Comment

by:murbro
ID: 37823713
Hi. These aren't bound columns and I hold the names in array of over two hundred items. I need to loop through and add a ComboBox column for each string in my array arrColumns
0
 
LVL 17

Expert Comment

by:nepaluz
ID: 37823898
What exactly do you mean that these are not bound columns? Is it that you want to add bound comboboxcolumns to an existing grid or that you want to add columns to a grid that is bound to a datasource?

The examples above will programatically add a datagridviewcomboboxcolumn to a datagridview with a choice of inserting it (the column) at your desired location or adding it to the end, (just like you asked).

Please clarify what you mean.
0
 

Author Closing Comment

by:murbro
ID: 37824025
Thanks. My mistake. Your answer was just what I needed
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question