1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| PrivateSub BindingNavigatorDeleteItem_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
Dim queryString As String
Dim LigneCurr As Integer
Dim ValRéfServiceI
Dim DrState As DataRowState
'MsgBox("début de BindingNavigatorDeleteItem Dans TableService "
LigneCurr =
Me .TableServiceDataGridView.CurrentCell.RowIndex
'MsgBox("LigneCurr = " & LigneCurr
ValRéfServiceI =
Me .TableServiceDataGridView.CurrentRow.Cells(0).Value
'suppression du dataGridView modif ici
Me .TableServiceBindingSource.Current.Row.BeginEdit()
'mettre à jour le formulaire
If Me .Validate Then
'arreter la saisie en cours
'Me.TableServiceBindingSource.EndEdit()
'essayer de mettre à jour les données
Try
'modif du 20/03/2007 de la ligne * :
' Me.TableServiceTableAdapter.Update(Me.DataSetService.TableService)
'suppression de la table
queryString =
"DELETE FROM TableService WHERE RéfService =" & ValRéfServiceI
MessageBox.Show(
"queryString = " & queryString)
ExecuteRequete(queryString)
'modif du 20/03/2007 ajout :
DrState = DataRowState.Deleted
MsgBox(DrState)
Me .TableServiceBindingSource.Current.Row.RowState() = DrState
'Me.DataSetService.TableService.AcceptChanges()
MsgBox(
Me .TableServiceBindingSource.Current.Row.RowState())
'deplacement de la ligne * ici :
Me .TableServiceTableAdapter.Update( Me .DataSetService.TableService)
Me .DataSetService.TableService.AcceptChanges()
Me .TableServiceTableAdapter.Update( Me .DataSetService.TableService)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Else : MessageBox.Show( "des erreurs ont été detectées." )
End If
'arreter la saisie en cours
' Me.TableServiceBindingSource.EndEdit()
MsgBox(
"Enregistrement supprimé" )
fintrait:
Exit Sub |
Partager