PC Review


Reply
Thread Tools Rate Thread

DataGridViewComboBoxColumn Added to DataGridView not working

 
 
SteveKing
Guest
Posts: n/a
 
      16th Dec 2008
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: DataGridViewComboBoxColumn change to automatically update DataGridView Fred Microsoft VB .NET 0 25th Jan 2010 07:08 AM
DataGridView, DataGridViewComboBoxColumn problems Dave Microsoft Dot NET Framework Forms 0 1st May 2008 02:52 PM
Data error DataGridView DataGridViewComboBoxColumn QSIDeveloper Microsoft Dot NET 10 10th Mar 2008 04:43 AM
DataGridView with DataGridViewComboBoxColumn ewald.de.vries@gmail.com Microsoft Dot NET Framework Forms 1 2nd Aug 2006 02:23 PM
DataGridView DataGridViewComboBoxColumn Nathan Franklin Microsoft Dot NET Framework 1 20th Jan 2006 04:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:50 AM.