Home All Groups Group Topic Archive Search About
Author
18 Jul 2006 2:18 PM
mfleet1973@yahoo.ca
Hi.

A datagrid is linked to a dataview.  The user double-clicks on the grid
and the screen changes to a data-input screen.  The user makes changes
and clicks on a button to accept those changes.  The code I have for
this is as follows:

Try
    If DataSet1.HasChanges Then
      DataAdapter1.Update(DataSet1.GetChanges, "Table")
      DataSet1.AcceptChanges()
    End If
Catch x As Exception
    MsgBox(x.Message)
End Try

Problem is that it never goes into the "If" block even though the
visual controls are bound to the data fields and user makes changes.
The program does not seem to detect that changes were made even though
there were.

Is there something that I'm doing wrong or missing in my code?

Many thanks!

Mike.

Author
18 Jul 2006 3:19 PM
Cor Ligthert [MVP]
Mike,

Are you sure that is forever, because the data is pushed down by a rowchange
in a grid.

To force that push down, you need for the datagrid the endcurrentedit

http://msdn2.microsoft.com/en-us/library/system.windows.forms.currencymanager.endcurrentedit.aspx

I hope this helps,

Cor

<mfleet1***@yahoo.ca> schreef in bericht
Show quoteHide quote
news:1153232338.159514.232580@m73g2000cwd.googlegroups.com...
> Hi.
>
> A datagrid is linked to a dataview.  The user double-clicks on the grid
> and the screen changes to a data-input screen.  The user makes changes
> and clicks on a button to accept those changes.  The code I have for
> this is as follows:
>
> Try
>    If DataSet1.HasChanges Then
>      DataAdapter1.Update(DataSet1.GetChanges, "Table")
>      DataSet1.AcceptChanges()
>    End If
> Catch x As Exception
>    MsgBox(x.Message)
> End Try
>
> Problem is that it never goes into the "If" block even though the
> visual controls are bound to the data fields and user makes changes.
> The program does not seem to detect that changes were made even though
> there were.
>
> Is there something that I'm doing wrong or missing in my code?
>
> Many thanks!
>
> Mike.
>