[dba-VB] DataGridView BindingNavigator: Confirm delete row

Doug Steele dbdoug at gmail.com
Mon Oct 6 16:42:15 CDT 2008


Interesting..  I didn't try it out myself - I'm just starting to use
vb.netand didn't have an easily set up program.  StackOverflow is at
www.stackoverflow.com.  You can find the original question and answer by
searching for the tag 'vb.net'.

I have to say that in the small amount of vb.net coding I've done so far,
finding events in vb that correspond to events in Access can be quite a
@#$%@& learning experience.

Doug

On Mon, Oct 6, 2008 at 2:28 PM, Gustav Brock <gustav at cactus.dk> wrote:

> Hi Doug
>
> You are most welcome. Could you provide a link, please?
>
> Problem is, however, that this suggestion was one of my first attempts -
> only to find out that this event is fired _after_ the actual deleting has
> been carried out - and as it carries no "Cancel" parameter or similar, it
> can only be used for something else you wish to do when that toolbarbutton
> has been clicked.
>
> While, coming from Access, I still wonder why this simple feature is not
> ready-built, I'm not in the mood to start modifying the native
> bindingnavigator as my workaround functions very well.
>
> As I wanted the deleted row (when confirmed) to be removed from the
> database at once, I included this code:
>
>        private void dataGridView1_RowsRemoved(object sender,
> DataGridViewRowsRemovedEventArgs e)
>        {
>            if (e.RowCount > 0)
>            {
>                this.Cursor = Cursors.WaitCursor;
>                // Delete from the source the deleted row.
>                this.dessinNoBindingSource.EndEdit();
>                this.productTableAdapter.Update(this.karnelia.Product);
>                this.Cursor = Cursors.Default;
>            }
>        }
>
> This also executes after the user has selected a row and pressed the Delete
> key.
>
> /gustav
>
>
> http://www.databaseadvisors.com
>
>



More information about the dba-VB mailing list