Question How to insert data directly from textboxes to DGV?

JCel

Active member
Joined
Jun 15, 2009
Messages
30
Programming Experience
Beginner
Hi there,

I'm using VB.Net 2005 appln with MS-Access 2007 as database.
In my appln i'm using a datagridview1 control,

before using this datagridview i'm able to insert records directly from my TextBoxes..

But after after using datagridview control i cant insert or can't open my connection...

Could you please help me in providing a solution to it?

Regards,
JCel
 
There is nothing inherent in using a DataGridView that prevent you inserting or opening a connection, so it must be something wrong with what you're doing. Without seeing what you're doing we can't tell you what that might be.

That said, the pattern is fairly simple:

1. Call Fill on a TableAdapter or DataAdapter to populate a DataTable.
2. Bind the DataTable to your grid.
3. Add a new row to the DataTable with the data from your TextBoxes, which will automatically update the grid.
4. Call Update on a TableAdapter or DataAdapter to save the changes from the DataTable to the database.
 

Latest posts

Back
Top