Data grid inserting value using code

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

Guest

I have a datagrid on a windows form that is filled using a data adapter and
dataset created in code. I have mapped columns to the various fields. The
user enters new infromation into the grid and then clicks a save button on
the toolbar to save the updated or new data. Two questions:

1. How do I let the user move directly from the row of newly inserted data
to the button and get the data to save. HasChanges does not recoginize the
row has changes unless we click in another row first.

2. I want to insert a specific value into one of the columns to be saved
with the changed column(s). I also need to know which row has the changes.

How do I accomplish this in vb.NET?

Thanks,
 
1. How do I let the user move directly from the row of newly inserted data
to the button and get the data to save. HasChanges does not recoginize the
row has changes unless we click in another row first.

Probably one of the most asked questions in the dotNet newsgroups.
\\\as sample
BindingContext(ds.Tables(0)).EndCurrentEdit()
///
Before the test on haschanges by instance
2. I want to insert a specific value into one of the columns to be saved
with the changed column(s). I also need to know which row has the changes.

How do I accomplish this in vb.NET?

Every datarow has a rowstate, however you have to find those row while
looping throught the dataset.

http://msdn.microsoft.com/library/d.../frlrfsystemdatadatarowclassrowstatetopic.asp

I hope this helps?

Cor
 
Back
Top