Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original
Este tópico ainda não foi avaliado como - Avalie este tópico

DataGridViewRowErrorTextNeededEventArgs Classe

Provides data for the RowErrorTextNeeded event of a DataGridView control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (em System.Windows.Forms. dll)
public class DataGridViewRowErrorTextNeededEventArgs : EventArgs

The RowErrorTextNeeded event occurs only when the DataGridView control DataSource property is set or its VirtualMode property is true.Handling the RowErrorTextNeeded event is useful when you want to determine the error for a row depending on its state and the values it contains.

When you handle the RowErrorTextNeeded event and specify error text in the handler, an error glyph appears in the row header unless the DataGridView.ShowRowErrors property is set to false.Quando o usuário move o ponteiro do mouse sobre o glifo de erro, o texto de erro é exibido em uma dica de ferramenta.

The RowErrorTextNeeded event also occurs whenever the value of the DataGridViewRow.ErrorText property is retrieved.

You can use the RowIndex property to determine the state or value of a row, and use this information to change or modify the ErrorText property.This property is initialized with the value of the row ErrorText property, which the event value overrides.

Handle the RowErrorTextNeeded event when working with large amounts of data to avoid the performance penalties of setting the row ErrorText value for multiple rows.Para obter mais informações, consulte Práticas recomendadas para escala o controle DataGridView do Windows Forms.

For more information about handling events, see Consumindo Eventos.

O exemplo de código a seguir demonstra o uso desse tipo.In the example, an event handler reports on the occurrence of the RowErrorTextNeeded event.Esse relatório ajuda você a saber quando o evento ocorre e pode ajudá-lo a depurar.To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type DataGridView named DataGridView1.Then ensure that the event handler is associated with the RowErrorTextNeeded event.

private void DataGridView1_RowErrorTextNeeded(Object sender, DataGridViewRowErrorTextNeededEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowErrorTextNeeded Event" );
}


System.Object
  System.EventArgs
    System.Windows.Forms.DataGridViewRowErrorTextNeededEventArgs
Quaisquer membros públicos estático (compartilhados na Visual Basic) desse tipo são Thread seguro. Não há garantia de que qualquer membro de instância seja isento de segmentos.
Isso foi útil para você?
(1500 caracteres restantes)

Contribuições da comunidade

ADICIONAR
© 2013 Microsoft. Todos os direitos reservados.