Nyelv

EventDescriptorCollection.Find(String, Boolean) Metódus

Definíció

Lekéri az esemény leírását a gyűjteményben megadott névvel.

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

Paraméterek

name
String

A gyűjteményből lekérendő esemény neve.

ignoreCase
Boolean

trueha figyelmen kívül szeretné hagyni az esemény esetét; egyéb esetben. false

Válaszok

A EventDescriptor megadott névvel, vagy null ha az esemény nem létezik.

Példák

Az alábbi példakód megkeres egy adott kódot EventDescriptor. Az összetevő EventDescriptor típusát egy szövegdobozban nyomtatja ki. Ehhez szükség van rá, button1 és textBox1 egy űrlapon lettek példányosítva.

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

Megjegyzések

Note

Az HostProtectionAttribute osztályra alkalmazott attribútum a következő Resources tulajdonságértéket tartalmazza: Synchronization. Ez HostProtectionAttribute nem érinti az asztali alkalmazásokat (amelyek általában egy ikonra duplán kattintva, egy parancs beírásával vagy egy URL-cím beírásával indulnak el a böngészőben). További információ: HostProtectionAttribute osztály vagy SQL Server Programozási és gazdagépvédelmi attribútumok.

A következőre érvényes:

Lásd még