Groups | Blog | Home
all groups > dotnet windows forms databinding > june 2006 >

dotnet windows forms databinding : .AddNew() without clearing the form


JoshDCrosby NO[at]SPAM gmail.com
6/17/2006 7:11:56 PM
Hello I have a form that is a bunch of combos/texboxes etc and is used
strictly for data entry, the customer would like to have the ability
after saving the record to have the data stay on the screen, because
most of the time the data is nearly identical - strange I know believe
me :)

Anyway the form is bound to a typed dataset and after the form is
saved, I call a BindingContext...AddNew() to add a new record to the
dataset, works beatiful, great.

is there a setting or override to prevent the data from clearing when
this method is called?

I have been pulling my hair out for the last week, i.e. saving the
dataset to xml, then reloading it back in - major problems there,
anyways I would appreciate the help.

I hope some of you have run into this before and have a solution
before, it seems sooo damn easy to.

Thanks Josh
Joanna Carter [TeamB]
6/18/2006 12:00:00 AM
<JoshDCrosby@gmail.com> a écrit dans le message de news:
1150596716.717502.326880@f6g2000cwb.googlegroups.com...

| I hope some of you have run into this before and have a solution
| before, it seems sooo damn easy to.

How about using the Add method and pass in a copy of the last record ?

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer

JoshDCrosby NO[at]SPAM gmail.com
6/18/2006 10:43:24 AM
Exactly

[quoted text, click to view]
Rick Mogstad
7/6/2006 8:06:56 AM
dim aRow() as object = CType(BindingSource.Current,
DataRowView).Row.ItemArray
BindingSource.AddNew
CType(BindingSource.Current, DataRowView).Row.ItemArray = aRow

I haven't tried this specific code, but I have similar code that works just
fine to copy value from one record to another.




[quoted text, click to view]

AddThis Social Bookmark Button