Click here to Skip to main content
14,449,862 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a form with Datagridview but i need help to create the "for each loop" something to stored into datagridview from database access. something like ".item(i, 0) = sqlrecord(0)" or "DataGridView1.Rows.Item(0) = sqlrecord(0)"

What I have tried:

DataGridView1.Rows.Item(0) = sqlrecord(0)
Posted
Updated 9-Feb-20 18:44pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If I understand your question correctly, you can use DataGrid.ItemsSource Property (System.Windows.Controls) | Microsoft Docs[^] to define the data source which is used to populate the rows of the data grid view.

You can use for example OleDbDataAdapter.Fill Method (System.Data.OleDb) | Microsoft Docs[^] to populate the data table first and then assign it to the grid.
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100