Prev: Executables
Next: vb script for opening notepad
From: Patrick A on 22 Apr 2010 18:27 I'm going around circles with this one. In the following code, > clicking the Yes button makes 2 rows disappear from the DataGridView, (which I don't want) but only 1 delete from the underlying db (as desired). > clicking the No button makes 1 row disappear from the DataGridView, (which I don't want) with none deleting from the underlying db (as desired). > clicking the Cancel button has the same effect as clicking the No button. Can anyone tell me what I've done wrong? In addition, if anyone knows of a good working sample of code where you can delete all of the "highlighted" rows from a DataGridView (if that's what you want) I'm all ears! (Or eyes.) Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click Dim myAnswer As System.Windows.Forms.DialogResult = MessageBox.Show("Once you delete a button, it's gone. Delete it?", "Delete?", MessageBoxButtons.YesNoCancel) Select Case myAnswer Case Windows.Forms.DialogResult.Yes If Me.TBL_TimersDataGridView.SelectedRows.Count > 0 AndAlso _ Not Me.TBL_TimersDataGridView.SelectedRows(0).Index = _ Me.TBL_TimersDataGridView.Rows.Count - 1 Then Me.TBL_TimersDataGridView.Rows.RemoveAt( _ Me.TBL_TimersDataGridView.SelectedRows(0).Index) Me.TBL_TimersBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.L55TimerDataSet) End If Case Windows.Forms.DialogResult.No Me.Focus() Case Windows.Forms.DialogResult.Cancel Me.Focus() End Select End Sub
From: Bob Butler on 22 Apr 2010 18:29 "Patrick A" <parkins(a)stradley.com> wrote in message news:19833a24-6625-43b6-bae2-9fd30bb86d1d(a)y17g2000yqd.googlegroups.com... > I'm going around circles with this one. and you took a left turn somewhere <g> This group is for VB6 and earlier; the code you posted in for VB.Net and has little in common with VB. You need to post your question in a group with "dotnet" in the name.
From: Patrick A on 22 Apr 2010 22:35 Bob, Thanks for the directions... Patrick On Apr 22, 6:29 pm, "Bob Butler" <no...(a)nospam.ever> wrote: > "Patrick A" <park...(a)stradley.com> wrote in message > > news:19833a24-6625-43b6-bae2-9fd30bb86d1d(a)y17g2000yqd.googlegroups.com... > > > I'm going around circles with this one. > > and you took a left turn somewhere <g> > > This group is for VB6 and earlier; the code you posted in for VB.Net and has > little in common with VB. You need to post your question in a group with > "dotnet" in the name.
|
Pages: 1 Prev: Executables Next: vb script for opening notepad |