Permalink
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (44 sloc) 3.57 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Handle Errors That Occur During Data Entry in the Windows Forms DataGridView Control
03/30/2017
.net-framework
dotnet-winforms
article
jsharp
error handling, DataGridView control
data grids, error handling
DataGridView control [Windows Forms], error handling
data entry, error handling
error handling, data entry
9004e72f-fdec-4264-a37d-2c99764efc13
19
dotnet-bot
dotnetcontent
wpickett

How to: Handle Errors That Occur During Data Entry in the Windows Forms DataGridView Control

The following code example demonstrates how to use the xref:System.Windows.Forms.DataGridView control to report data entry errors to the user.

For a complete explanation of this code example, see Walkthrough: Handling Errors that Occur During Data Entry in the Windows Forms DataGridView Control.

Example

[!code-csharpSystem.Windows.Forms.DataGridView.DataError#00] [!code-vbSystem.Windows.Forms.DataGridView.DataError#00]

Compiling the Code

This example requires:

  • References to the System, System.Data, System.Windows.Forms, and System.XML assemblies.

For information about building this example from the command line for [!INCLUDEvbprvb] or [!INCLUDEcsprcs], see Building from the Command Line or Command-line Building With csc.exe. You can also build this example in [!INCLUDEvsprvs] by pasting the code into a new project. Also see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.

.NET Framework Security

Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see Protecting Connection Information.

See Also

xref:System.Windows.Forms.DataGridView
xref:System.Windows.Forms.BindingSource
Walkthrough: Handling Errors that Occur During Data Entry in the Windows Forms DataGridView Control
Data Entry in the Windows Forms DataGridView Control
Walkthrough: Validating Data in the Windows Forms DataGridView Control
Protecting Connection Information