Solved

VB.net Programatically add a ComboBox column

Posted on 2012-04-09
4
724 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with converting xml file to excel using VB.NET 3 25
ASP/VB email question 4 46
SSRS 2016 Rendering HTML tables 3 31
DataGridView / get bound table name? 8 28
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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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