0

How to get selected DataGridViewComboBoxColumn values in vb.net?

4

1 回答 1

2

The first link in my google search :-)

How to: Access Objects in a Windows Forms DataGridViewComboBoxCell Drop-Down List

There is a complete example on this MSDN page.

Specifically note the following regarding getting the selected values

Unlike the ComboBox control, the DataGridView types do not have a SelectedItem propertyfor retrieving the currently selected object. Instead, you must set the System.Windows.Forms.DataGridViewComboBoxColumn.ValueMember or System.Windows.Forms.DataGridViewComboBoxCell.ValueMember property to the name of a property on your business object. When the user makes a selection, the indicated property of the business object sets the cell Value property.

Click on "VB" in the code boxes to see the appropriate VB.net code syntax

于 2010-12-09T04:17:29.793 回答