Solved

VB.net Add items from an array to all ComboBox columns in a DataGridView row

Posted on 2012-04-09
2
642 Views
Last Modified: 2012-04-09
Hi

I need to add the items in an array to all the ComboBox columns in a DataGridView that has over a hundred columns. Is there an easy way to add these items to only row 1 of a ComboBox? What code would I use?

Thanks
0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
ID: 37825174
Is this related to your last question I responded to? If so, in the CellValidating event, simply cast the cb variable to the first row combobox then add the values to that, e.g
Dim cb = CType(DataGridView1.Item(DataGridView1.CurrentCell.ColumnIndex, 0), DataGridViewComboBoxCell)

Open in new window

Here, you willalways beadding the new values to the first row combo (you may get the error you were getting previously though!)
0
 

Author Closing Comment

by:murbro
ID: 37825216
Thanks very much and yes it is related
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

707 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