Click here to Skip to main content
15,175,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do i Fill Windows Form TextBoxes and Datagridview programmatically in from MS Access

What I have tried:


I guess this is for bound Database

But is it possible to do it without binding the database?
Updated 22-Nov-21 0:36am
Gerry Schmitz 21-Nov-21 21:31pm
You're mixing binding and connecting and reading. In any event, what concern you seem to be voicing is unwarranted based on what you've shown so far.

1 solution

The Fill operation has nothing to do with databinding: it instructs the system to execute the SELECT command you previously specified on the database, and return the results in the form of DataTables as part of the DataSet.
That isn't databinding - it's a one-of process with just reads data and returns it to your app.

There are three ways to programatically add data to Controls which involve no databinding or database automation:
1) Create your columns in code and add them to your DataGridView.Columns collection, then use DataGridView.Rows.Add to add values for each row in turn.
2) Create a DataTable in code, and populate it with the data you want to display. You can then set the DataTable as the DataSource for the DataGridView and it will fill itself.
3) Create a class which contains a public property for each column you want to display, then create and populate an instance for each row you want, build a collection (array, List, whatever) of these, and set that as the DataSource for the DataGridView. Again, it will fill itself from them.

You can use whatever source you like to get the date for any of those methods.
Beginner213456 24-Nov-21 3:59am
Thank you.. i am trying the no.1 in your suggestions

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