Sugerir traducción
 
Otros han sugerido:

progress indicator
No hay más sugerencias.
Evaluar y enviar comentarios
Contraer todo/Expandir todo Contraer todo
Ver contenido:  en paraleloVer contenido: en paralelo
.NET Framework Class Library
DataRow..::.SetColumnError Method (Int32, String)

Sets the error description for a column specified by index.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)
Visual Basic
Public Sub SetColumnError ( _
    columnIndex As Integer, _
    error As String _
)
C#
public void SetColumnError(
    int columnIndex,
    string error
)
Visual C++
public:
void SetColumnError(
    int columnIndex, 
    String^ error
)
F#
member SetColumnError : 
        columnIndex:int * 
        error:string -> unit 

Parameters

columnIndex
Type: System..::.Int32
The zero-based index of the column.
error
Type: System..::.String
The error description.
ExceptionCondition
IndexOutOfRangeException

The columnIndex argument is out of range

The method is used to set custom error descriptions on specified columns. You can use the ErrorProvider control to display the text of the error.

To examine error descriptions, use the GetColumnError method.

To determine whether any errors exist for the columns collection, use the HasErrors property. Consequently, you can use the GetColumnsInError method to retrieve all the columns with errors.

If nullNothingnullptra null reference (Nothing in Visual Basic) or an empty string is passed in as the error parameter, the DataRow behaves as if no error was set and the HasErrors property will return false.

To set a custom error description on the whole row, use the RowError property.

To clear all errors for the columns collection, use the ClearErrors method.

To set error text that applies to a whole row, set the RowError property.

The following example sets an error description for a specified DataRow.

Visual Basic
Private Sub SetColError(ByVal row As DataRow, _
    byVal columnIndex As Integer)
    Dim errorString As String = "Replace this text."

    ' Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString)
End Sub

Private Sub PrintColError( _
    ByVal row As DataRow, byVal columnIndex As Integer)

    ' Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex))
End Sub
C#
private void SetColError(DataRow row, int columnIndex)
{
    string errorString = "Replace this text.";

    // Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString);
}

private void PrintColError(DataRow row, int columnIndex)
{
    // Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex));
}

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Biblioteca de clases de .NET Framework
DataRow..::.SetColumnError (Método) (Int32, String)

Establece la descripción de error para una columna especificada mediante un índice.

Espacio de nombres:  System.Data
Ensamblado:  System.Data (en System.Data.dll)
Visual Basic
Public Sub SetColumnError ( _
    columnIndex As Integer, _
    error As String _
)
C#
public void SetColumnError(
    int columnIndex,
    string error
)
Visual C++
public:
void SetColumnError(
    int columnIndex, 
    String^ error
)
F#
member SetColumnError : 
        columnIndex:int * 
        error:string -> unit 

Parámetros

columnIndex
Tipo: System..::.Int32
Índice de base cero de la columna.
error
Tipo: System..::.String
Descripción de error.
ExcepciónCondición
IndexOutOfRangeException

El argumento columnIndex está fuera de intervalo.

El método se utiliza para establecer descripciones de error personalizadas de columnas especificadas. El control ErrorProvider se puede utilizar para mostrar el texto del error.

Para examinar las descripciones de error, utilice el método GetColumnError.

Para determinar si existen errores en la colección de columnas, utilice la propiedad HasErrors. Por tanto, puede utilizar el método GetColumnsInError para recuperar todas las columnas con errores.

Si se pasa nullNothingnullptrreferencia null (Nothing en Visual Basic) o una cadena vacía como el parámetro error, el objeto DataRow se comporta como si no se hubiese enviado un error y la propiedad HasErrors devolverá el valor false.

Para establecer una descripción de error personalizada de toda la fila, utilice la propiedad RowError.

Para borrar todos los errores de la colección de columnas, utilice el método ClearErrors.

Para establecer un texto de error que se aplique a toda una fila, establezca la propiedad RowError.

En el ejemplo siguiente se establece una descripción de error para un DataRow especificado.

Visual Basic
Private Sub SetColError(ByVal row As DataRow, _
    byVal columnIndex As Integer)
    Dim errorString As String = "Replace this text."

    ' Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString)
End Sub

Private Sub PrintColError( _
    ByVal row As DataRow, byVal columnIndex As Integer)

    ' Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex))
End Sub
C#
private void SetColError(DataRow row, int columnIndex)
{
    string errorString = "Replace this text.";

    // Set the error for the specified column of the row.
    row.SetColumnError(columnIndex, errorString);
}

private void PrintColError(DataRow row, int columnIndex)
{
    // Print the error of a specified column.
    Console.WriteLine(row.GetColumnError(columnIndex));
}

.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2

.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker