all groups > vb.net controls > november 2006 >
You're in the

vb.net controls

group:

VS2005 and BindingNavigator


VS2005 and BindingNavigator JJ
11/10/2006 7:36:21 PM
vb.net controls:
I am really baffled by this BindingNavigator thing, and hey I'm a
newbie and trying to figure this stuff out.

I drag a field from my dataset onto the form, and this
bindingnavigator is created for me, ya know, with all the buttons to
navigate, add, delete and such.

So how come, if I delete a record, I need to press the Save button for
the deleted record to really get deleted?

So the code for BindingNavigatorDeleteItem_Click contains nothing, and
this is the confusing part, where the heck is this code, and why can't
I see it?

So I add :

Me.Validate()
Me.DistributeBindingSource.EndEdit()
Me.DistributeTableAdapter.Update(Me.ProcureDataSet.Distribute)
like I see in the SaveItem method, and still, nothing happens.

Everyone says I need to code by hand, but I believe that the
development environment should do the bulk of the work for me. Am I
supposed to know that most of the code for this navigator has been
written for me, but some other stuff will have to be written manually?

Re: VS2005 and BindingNavigator RobinS
11/11/2006 11:44:38 AM
Changes saved via the Binding Navigator save the
changes to the dataset in memory. They do not persist
the changes down to the database level. You have to
write that code yourself. One way (the easiest) to do
that is to run an Update method on the Table Adapter,
which runs queries that are in the generated code.

To see the generated code, select <Show All Files>
in your Solution explorer, then look at the Designer.vb
file for your form. Visual Studio generates thousands
of lines of code for you to do data binding.

There are a multitude of ways, depending on your business
requirements, to update the database with changes in a
dataset. As is appropriate, Microsoft does not assume
one specific method, but leaves it up to you to choose
your own, uh, poison.

The events for Save and Delete and Add are not written
for you because you may not allow updating of the recordset.
Also, these can be handled differently in each application.
For example, I handle the <Save> option through an interface
on my business object, not through the TableAdapter.

Robin S.


[quoted text, click to view]

Re: VS2005 and BindingNavigator JJ
11/11/2006 2:08:05 PM
Thanks for the update Robin. Now that I know that I can proceed
accordingly.

On Sat, 11 Nov 2006 11:44:38 -0800, "RobinS" <RobinS@NoSpam.yah.none>
[quoted text, click to view]
AddThis Social Bookmark Button