Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Db2DataSet.Notes' table. You can move, or remove it, as needed.
Me.NotesTableAdapter.Fill(Me.Db2DataSet.Notes)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataGridView1.Rows.Add(Db2DataSet.Tables(0).Rows.Count)
For i As Integer = 0 To Db2DataSet.Tables(0).Rows.Count - 1
For j As Integer = 0 To Db2DataSet.Tables(0).Rows(i).ItemArray().Count - 1
If j <> 1 Then
DataGridView1.Rows(i).Cells(j).Value = Db2DataSet.Tables(0).Rows(i).Item(j)
Else
Dim c As DataGridViewComboBoxCell = New DataGridViewComboBoxCell()
For Each rho As DataRow In Db2DataSet.Tables(0).Rows
c.Items.Add(rho.Item(1))
Next
DataGridView1.Rows(i).Cells(1) = c
End If
Next j
Next i
End Sub
End Class
|