EventDescriptorCollection::Find Method (String^, Boolean)

 

Gets the description of the event with the specified name in the collection.

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

public:
virtual EventDescriptor^ Find(
	String^ name,
	bool ignoreCase
)

Parameters

name
Type: System::String^

The name of the event to get from the collection.

ignoreCase
Type: System::Boolean

true if you want to ignore the case of the event; otherwise, false.

Return Value

Type: System.ComponentModel::EventDescriptor^

The EventDescriptor with the specified name, or null if the event does not exist.

System_CAPS_noteNote

The HostProtectionAttribute attribute applied to this class has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

The following code example finds a specific EventDescriptor. It prints the type of component for this EventDescriptor in a text box. It requires that button1 and textBox1 have been instantiated on a form.

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

.NET Framework
Available since 1.1
Return to top
Show: