Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 17:44pm
v2

1 solution

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.
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900