I'm about at the end of my rope. I have a datagrid view with several bound columns and one unbound one. When the form is loaded, the data adapter is called to fill the datagrid. Then I need to go through each row, run a SQL Query based on 3 outside values and the data in column 0. With the data I get from that, I need to populate the next column which is a Combo Box. Everything I have seen on the internet so far, pertains to the creation of a column, not the manipulation of an existing one.
Here is code that works, but I don't know how to transfer the items to the current dropdown:
For RowIndex = 0 To Me.PSDShangerDataSet.JobRelBom.Count - 1
Row = JobRelBomDataGridView.Rows(RowIndex)
cell = Row.Cells(0)
numLineItem = CInt(cell.Value)
' Function that returns a string array...
strBomShopOps = GetBomShopOps(JobNumber, ReleaseNumber, MarkNo, numLineItem, numRows)
cell = Row.Cells(1)
Dim tempCol2 As DataGridViewComboBoxCell = CType(Row.Cells(1), DataGridViewComboBoxCell)
'Populate tempCol2 with new data
If strBomShopOps.Length > 0 Then
For y = 0 To strBomShopOps.Length - 1
If strBomShopOps > "" Then
tempCol2.Items.Add(strBomShopOps)
End If
Next
Dim numItems As Integer = tempCol2.Items.Count
Dim strValue As String = tempCol2.Items(0).ToString()
' Set the displayed value.
' This value needs to be present
' in the items collection
' Row.Cells(1) = tempCol2 <---- DOES NOT WORK
End If
Next
I initially presume that sfter I fill up the tempCol2, that I somehow have to transfer it to the Row.Cells(1) somehow, but that's where I'm stuck.
Thanks in advance,
Jerry Scannell
Here is code that works, but I don't know how to transfer the items to the current dropdown:
For RowIndex = 0 To Me.PSDShangerDataSet.JobRelBom.Count - 1
Row = JobRelBomDataGridView.Rows(RowIndex)
cell = Row.Cells(0)
numLineItem = CInt(cell.Value)
' Function that returns a string array...
strBomShopOps = GetBomShopOps(JobNumber, ReleaseNumber, MarkNo, numLineItem, numRows)
cell = Row.Cells(1)
Dim tempCol2 As DataGridViewComboBoxCell = CType(Row.Cells(1), DataGridViewComboBoxCell)
'Populate tempCol2 with new data
If strBomShopOps.Length > 0 Then
For y = 0 To strBomShopOps.Length - 1
If strBomShopOps > "" Then
tempCol2.Items.Add(strBomShopOps)
End If
Next
Dim numItems As Integer = tempCol2.Items.Count
Dim strValue As String = tempCol2.Items(0).ToString()
' Set the displayed value.
' This value needs to be present
' in the items collection
' Row.Cells(1) = tempCol2 <---- DOES NOT WORK
End If
Next
I initially presume that sfter I fill up the tempCol2, that I somehow have to transfer it to the Row.Cells(1) somehow, but that's where I'm stuck.
Thanks in advance,
Jerry Scannell