Assembly : System.Data (dans system.data.dll)
SyntaxePublic Sub EndEdit
Dim instance As DataRow instance.EndEdit
public void EndEdit ()
public: void EndEdit ()
public void EndEdit ()
public function EndEdit ()
Exceptions| Type d'exception | Condition |
|---|---|
| La méthode a été appelée au sein de l'événement RowChanging. | |
| La modification a interrompu une contrainte. | |
| La ligne appartient à la table et la modification a tenté de changer la valeur d'une colonne en lecture seule. | |
| La modification a tenté d'insérer une valeur null dans une colonne dont AllowDBNull a la valeur false. |
NotesLorsque vous définissez la propriété, une exception est générée si une exception se produit dans l'événement RowChanging.
ExempleL'exemple suivant modifie la valeur d'une colonne dans la dernière ligne d'un contrôle DataGrid. L'exemple utilise les méthodes BeginEdit et EndEdit pour modifier la valeur de la colonne et valider la modification apportée à la ligne.
Private Sub AcceptOrReject(ByVal row As DataRow) ' Use a function to validate the row's values. ' If the function returns true, end the edit; ' otherwise cancel it. If ValidateRow(row) Then row.EndEdit() Else row.CancelEdit() End If End Sub Private Function ValidateRow(ByVal row As DataRow) As Boolean Dim isValid As Boolean ' Insert code to validate the row values. ' Set the isValid variable. ValidateRow = isValid End Function
private void AcceptOrReject(DataRow row) { // Use a function to validate the row's values. // If the function returns true, end the edit; // otherwise cancel it. if(ValidateRow(row)) row.EndEdit(); else row.CancelEdit(); } private bool ValidateRow(DataRow thisRow) { bool isValid = true; // Insert code to validate the row values. // Set the isValid variable. return isValid; }
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ