Compartir por


EventDescriptorCollection.Find(String, Boolean) Método

Definición

Obtiene la descripción del evento con el nombre especificado en la colección.

public:
 virtual System::ComponentModel::EventDescriptor ^ Find(System::String ^ name, bool ignoreCase);
public virtual System.ComponentModel.EventDescriptor? Find(string name, bool ignoreCase);
public virtual System.ComponentModel.EventDescriptor Find(string name, bool ignoreCase);
abstract member Find : string * bool -> System.ComponentModel.EventDescriptor
override this.Find : string * bool -> System.ComponentModel.EventDescriptor
Public Overridable Function Find (name As String, ignoreCase As Boolean) As EventDescriptor

Parámetros

name
String

Nombre del evento que se va a obtener de la colección.

ignoreCase
Boolean

true si desea omitir el caso del evento; de lo contrario, false.

Devoluciones

EventDescriptor con el nombre especificado o null si el evento no existe.

Ejemplos

En el ejemplo de código siguiente se busca un elemento específico EventDescriptor. Imprime el tipo de componente para esto EventDescriptor en un cuadro de texto. Requiere que button1 y textBox1 se hayan creado instancias en un formulario.

private:
   void FindEvent()
   {
      // Creates a new collection and assigns it the events for button1.
      EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
      
      // Sets an EventDescriptor to the specific event.
      EventDescriptor^ myEvent = events->Find( "Resize", false );
      
      // Prints the event name and event description.
      textBox1->Text = String::Concat( myEvent->Name, ": ", myEvent->Description );
   }
void FindEvent()
{
    // Creates a new collection and assigns it the events for button1.
    EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);

    // Sets an EventDescriptor to the specific event.
    EventDescriptor myEvent = events.Find("Resize", false);

    // Prints the event name and event description.
    textBox1.Text = myEvent.Name + ": " + myEvent.Description;
}
Private Sub FindEvent()
    ' Creates a new collection and assigns it the events for button1.
    Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
    
    ' Sets an EventDescriptor to the specific event.
    Dim myEvent As EventDescriptor = events.Find("Resize", False)
    
    ' Prints the event name and event description.
    textBox1.Text = myEvent.Name & ": " & myEvent.Description
End Sub

Comentarios

Nota:

El HostProtectionAttribute atributo aplicado a esta clase tiene el siguiente Resources valor de propiedad: Synchronization. No HostProtectionAttribute afecta a las aplicaciones de escritorio (que normalmente se inician haciendo doble clic en un icono, escribiendo un comando o escribiendo una dirección URL en un explorador). Para obtener más información, consulte la clase o los HostProtectionAttributeatributos de programación y protección de host de SQL Server.

Se aplica a

Consulte también