I've created a DataGridView tblPpr_MilestonesDataGridView with a
bindingsource bsPpr as the DataSource which displays the data fine but my
objective is to replace the MilestoneID TextColumn with a
DataGridViewComboBoxColumn named comboCol. I bind the MilestoneList to
another combobox very successfully but when I try to bind it to the comboCol
the dropdown is now working even thought the correct Milestone is displayed.
This would seem to be a very simple problem but ... not for me right now. I
can't seem to crack it. Any assistance would be appreciated as this is the
last issue before deployment.
Me.tblPpr_MilestonesDataGridView.DataSource = bsPpr
Me.tblPpr_MilestonesDataGridView.DataMember =
"FK_tblPpr_Milestones_tblPPR"
' Create the MilestoneList as the datasource for the drop
downs
For Each rowItem As DataRow In Me.milestonesLookupTable.Rows
Dim CMile As New CMilestone( _
CType(rowItem("ID"), System.Int32), _
CType(rowItem("Milestone"), System.String), _
CType(rowItem("DurationInHours"), System.Int32), _
CType(rowItem("Sequence"), System.Int32), _
CType(rowItem("OPR"), System.String))
MilestoneList.Add(CMile)
Next rowItem
With Me.cboMilestoneAdd
.DataSource = MilestoneList
.DisplayMember = "Milestone"
End With
Me.cboMilestoneAdd.SelectedIndex = -1
AutoSizeDataGridView()
'Ref: Pro .NET 2.0 Windows, page 563
' Remove the auto-generated MilestoneID column
Me.tblPpr_MilestonesDataGridView.Columns.Remove("MilestoneID")
' Create a list column for the MilestoneID
comboCol.DisplayIndex = 0
comboCol.HeaderText = "Milestone"
comboCol.MaxDropDownItems = 8
' This column is bound to the tblPpr_Milestones.MilestoneID
comboCol.DataPropertyName = "MilestoneID"
' The list is filled from the MilestoneList collection
With comboCol
.DataSource = MilestoneList
.DisplayMember = "Milestone"
.ValueMember = "ID"
End With
' Add the column to the datagridview
Me.tblPpr_MilestonesDataGridView.Columns.Add(comboCol)
|