How to save changes to datagrid from a Windows form in vb.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm new to the VB.net world and have been reading alot of books and threw newsgroups
Is it even posable to save user input from a form to a data grid. I could just edit the data gri
but would prefer useing the user form to import the data

Any help would be greatly appreciated

Thanks
Homey
 
Hi Homey,

Can you explain this a little bit more because?.

A datagrid is a so called control on a dataform that can hold data on a
form.
A dataform it self has no property that can hold input data.

Cor
 
Hi Cor, Thanks!
I take it the data in thedatagrid is just a image of what has been
imported from the dataSet and theDataSet is just an image of the
database. What do I need to do to use a user form to add information to
the dataset and from there update the database? I see I can bind the
text box to the dataset but how do I import that data from the textbox
to the dataset? I might have rambled a little there.

Homey
 
Hi William,

What you are writing is true.
The sequence (one of the possibilities)
A database -> a dataset -> a control -> a dataset -> a database

A datatadapter.fill -> a dataset -> a datagrid.datasource -> a dataset -> a
dataadapter.update
A datatadapter.fill -> a dataset -> binded textboxes -> a dataset -> a
dataadapter.update

With the datagrid everything goes automaticly. Although there are some
strange things one of them not to forget is that you always have to say
"endcurrentedit" (have a search for that if you needed it) to get the last
datagrid change into the dataset.

With the textbox you have to bind that textbox text to the dataset telling
wich column is used (The syntax is almost the same as I write in natural
language above)

You go than through the textbox using the currencymanager position , have
also a look for it, it tells which row in the dataset is the current row,
(it has nothing to do with money, as some think).

I hope this helps a little bit.
 
Thanks again Cor,
I did a little more reading this morning and with your help I now
understand what the structure is alot better.
I noticed the DataGrid is realy just a place holder for the dataView
that can be minipulated to hold multiple DataBase tables in the
DataGrid. I'll work with this and figure it out. Thanks again you've a
great help.

Bill
 
Back
Top