title: Getting all events of a Control in C#
body: <p>I am trying to get all events information concerning a specific control.<br>
  For this purpose, I wrote a snippet of code that works if I hard code the class name, But when I try to make it dynamic it fails, That is it doesn't give any error, but instead, the events collection becomes null.<br>
  This is the code that works : </p>
  
  <pre><code>AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;
  
  var assembly = System.Reflection.Assembly.ReflectionOnlyLoadFrom(typeof(DataGridView).Module.FullyQualifiedName);
  var events = Type.ReflectionOnlyGetType(typeof(DataGridView).AssemblyQualifiedName, false, true).GetEvents();
  </code></pre>
  
  <p>And this is the counter part that fails:</p>
  
  <pre><code>AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;
  var assembly = System.Reflection.Assembly.ReflectionOnlyLoadFrom(cmbox.SelectedItem.GetType().Module.FullyQualifiedName);
  var events = Type.ReflectionOnlyGetType(cmbox.SelectedItem.GetType().AssemblyQualifiedName, false, true).GetEvents();
  </code></pre>
  
  <p>this <code>ComboBx</code> is filled with windows form controls like this : </p>
  
  <pre><code>var controlType = typeof(Control);
              var controls = controlType
                  .Assembly
                  .GetTypes()
                  .Where(t =&gt; controlType.IsAssignableFrom(t) &amp;&amp;
                              t.Namespace == "System.Windows.Forms"
                  );
              foreach (var control in controls)
              {
                  cmbox.Items.Add(control);
              }
  </code></pre>
  
  <p>And by the way this is the event handlers content : </p>
  
  <pre><code>Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args)
  {
        return System.Reflection.Assembly.ReflectionOnlyLoad(args.Name);  
  }
  </code></pre>
  
  <p>So what am I missing here? how to get around this ? </p>