EventDescriptorCollection.Find(String, Boolean) Metoda

Definicja

Pobiera opis zdarzenia o określonej nazwie w kolekcji.

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

Parametry

name
String

Nazwa zdarzenia do pobrania z kolekcji.

ignoreCase
Boolean

true jeśli chcesz zignorować przypadek zdarzenia; w przeciwnym razie , false.

Zwraca

Element EventDescriptor o określonej nazwie lub null jeśli zdarzenie nie istnieje.

Przykłady

Poniższy przykład kodu znajduje określony EventDescriptorelement . Wyświetla typ składnika dla tego EventDescriptor elementu w polu tekstowym. Wymaga to utworzenia button1textBox1 wystąpienia i utworzenia wystąpienia w formularzu.

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 );
   }
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 = 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

Uwagi

Uwaga

Atrybut HostProtectionAttribute zastosowany do tej klasy ma następującą Resources wartość właściwości: Synchronization. Atrybut HostProtectionAttribute nie ma wpływu na aplikacje pulpitu (które typowo są uruchamiane przez dwukrotne kliknięcie ikony, wpisanie polecenia albo wprowadzenie adresu URL w przeglądarce). Aby uzyskać więcej informacji, zobacz klasę HostProtectionAttribute lub SQL Server Programowanie i atrybuty ochrony hosta.

Dotyczy

Zobacz też