Solved

VB.net Programatically add a ComboBox column

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now