By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,979 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,979 IT Pros & Developers. It's quick & easy.

how best to edit data in a data grid

P: n/a
Hi guys,

I want to display the data of a table in a datagrid in one form,
& enable the user to edit the details of a particular record in another
form.

I want the following features,
1. display the data in a grid in one form
2. enable editing the data for a row in another form
3. checking if changes have been made, reverting the changes, saving the
changes
when editing the data of a particular record
(can use the revertchanges, acceptchanges & rowstate of the Row object).

Now how do go about doing this?
1. Pass the dataset & the row position to the next form,
2. bind the data
3. set the row position
4. then use the rowstate, rejectchanges and acceptchanges method of the row
object.

Is this the best (standard) way of editing data in a grid?????
Please do let me know,
as i'm new to vb.net & would like to adopt the best techniques from the
start...
(NOTE : Here I want more help in the architecture rather than coding)

--
Besty Regards,
TJ

Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Cor
Hi TJ,

No that is not why a datagrid is made for, you can do all you editing in the
datagrid, and if you make a button for saveall, resetall, and deleterow, it
is very easy.

You have to make a dataset, fill that using a dataadaper and bind that using
the datasource from the datagrid to that.

You can save the dataset using the dataadapter.update after you have done a
endcurrentedit using the bindingcontext and check if that
mydataset.haschanges

To reset you can use mydataset.rejectchanges.

You need very few code and the most is very simple, until you start making
it nicer, but that is in your other approach also..

I hope this helps?

Cor
(NOTE : Here I want more help in the architecture rather than coding)

Nov 20 '05 #2

P: n/a
Oki doki,
thanx,

"Cor" <no*@non.com> wrote in message
news:uj****************@TK2MSFTNGP11.phx.gbl...
Hi TJ,

No that is not why a datagrid is made for, you can do all you editing in the datagrid, and if you make a button for saveall, resetall, and deleterow, it is very easy.

You have to make a dataset, fill that using a dataadaper and bind that using the datasource from the datagrid to that.

You can save the dataset using the dataadapter.update after you have done a endcurrentedit using the bindingcontext and check if that
mydataset.haschanges

To reset you can use mydataset.rejectchanges.

You need very few code and the most is very simple, until you start making
it nicer, but that is in your other approach also..

I hope this helps?

Cor
(NOTE : Here I want more help in the architecture rather than coding)


Nov 20 '05 #3

P: n/a
I understand that the easiest way to edit data in a datagrid is directly through the datagrid, but I understand what T. Jackson was requesting and I would like to know how to do it too. I have a datagrid that pulls from a dataset that only includes necessary columns to browse through a customer list. I want to be able to either double-click the row of the customer I want to edit, or highlight the row and click an "edit" button. This should bring up a new form that allows the user to edit ALL attributes of the particular customer record through textboxes/checkboxes and such. I'm new to .NET, so maybe there is an easier way to do this than to use the datagrid. Can anyone elaborate on this

Thanks.

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #4

P: n/a
Cor
Hi ccoston,

If you have a question, post it as a new message, this seems as an answer,
while it is not, you can get a lot of samples on your questions here

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing it

http://msdn.microsoft.com/vbasic/vbr...q/#installvdir
I hope this helps a little bit?

Cor

I understand that the easiest way to edit data in a datagrid is directly
through the datagrid, but I understand what T. Jackson was requesting and I
would like to know how to do it too. I have a datagrid that pulls from a
dataset that only includes necessary columns to browse through a customer
list. I want to be able to either double-click the row of the customer I
want to edit, or highlight the row and click an "edit" button. This should
bring up a new form that allows the user to edit ALL attributes of the
particular customer record through textboxes/checkboxes and such. I'm new
to .NET, so maybe there is an easier way to do this than to use the
datagrid. Can anyone elaborate on this?

Thanks.

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.