From: jb on
Good Afternoon All,

I have a datagridview dgv1 that has a combobox column in it. Each row
should have an individual item to select from in the combobox. My code
displays the same values in all of them. Any help would be great!

Here's my code:

Dim dsMP As DataSet = New DataSet()

Dim intRow As Integer = 0
Dim intRows As Integer = dgvRO.Rows.Count

Dim strPartNumber As String = ""
Dim dt As DataTable = Nothing
Dim dr As DataRow = Nothing

For intRow = 0 To intRows - 1

strPartNumber = dgvRO.Rows(intRow).Cells("partno").Value

'LOAD DATASET WITH RESLOLUTION VALUES
With clsMP
.Owner = cboCompany.Text
dsMP = .GetAuthorizedVendors(strPartNumber)
End With

dgvRO.CurrentCell = dgvRO.Rows(intRow).Cells("cbovendor")
CType(dgvRO.Columns("cbovendor"),
DataGridViewComboBoxColumn).DataSource = dsMP.Tables(0)
CType(dgvRO.Columns("cbovendor"),
DataGridViewComboBoxColumn).DisplayMember = "vendor"
CType(dgvRO.Columns("cbovendor"),
DataGridViewComboBoxColumn).ValueMember = "vendor"

Next

dsMP.Dispose()

There are currently 5 rows. Each should have a different value in the
combobox, but they don't. What am I doing wrong???

Thanks.

jb
From: Bob Butler on

"jb" <jb(a)discussions.microsoft.com> wrote in message
news:2061211D-A2E4-4D98-863A-51883802AA6C(a)microsoft.com...
> Good Afternoon All,
>
> I have a datagridview dgv1 that has a combobox column in it. Each row
> should have an individual item to select from in the combobox. My code
> displays the same values in all of them. Any help would be great!
>
> Here's my code:
>
> Dim dsMP As DataSet = New DataSet()

this group is for VB6 and earlier; VB.Net questions need to go to wherever
they support that language.

From: Cor on
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?page=1

"jb" <jb(a)discussions.microsoft.com> wrote in message
news:2061211D-A2E4-4D98-863A-51883802AA6C(a)microsoft.com...
> Good Afternoon All,
>
> I have a datagridview dgv1 that has a combobox column in it. Each row
> should have an individual item to select from in the combobox. My code
> displays the same values in all of them. Any help would be great!
>
> Here's my code:
>
> Dim dsMP As DataSet = New DataSet()
>
> Dim intRow As Integer = 0
> Dim intRows As Integer = dgvRO.Rows.Count
>
> Dim strPartNumber As String = ""
> Dim dt As DataTable = Nothing
> Dim dr As DataRow = Nothing
>
> For intRow = 0 To intRows - 1
>
> strPartNumber = dgvRO.Rows(intRow).Cells("partno").Value
>
> 'LOAD DATASET WITH RESLOLUTION VALUES
> With clsMP
> .Owner = cboCompany.Text
> dsMP = .GetAuthorizedVendors(strPartNumber)
> End With
>
> dgvRO.CurrentCell = dgvRO.Rows(intRow).Cells("cbovendor")
> CType(dgvRO.Columns("cbovendor"),
> DataGridViewComboBoxColumn).DataSource = dsMP.Tables(0)
> CType(dgvRO.Columns("cbovendor"),
> DataGridViewComboBoxColumn).DisplayMember = "vendor"
> CType(dgvRO.Columns("cbovendor"),
> DataGridViewComboBoxColumn).ValueMember = "vendor"
>
> Next
>
> dsMP.Dispose()
>
> There are currently 5 rows. Each should have a different value in the
> combobox, but they don't. What am I doing wrong???
>
> Thanks.
>
> jb
>