Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Quick way to add block comments? Pin
jclark239b918-Nov-11 5:54
jclark239b918-Nov-11 5:54 
QuestionCircular dependency between classes Pin
vinayvraman15-Nov-11 6:34
vinayvraman15-Nov-11 6:34 
AnswerRe: Circular dependency between classes Pin
PIEBALDconsult15-Nov-11 6:46
mvePIEBALDconsult15-Nov-11 6:46 
AnswerRe: Circular dependency between classes Pin
Clive D. Pottinger15-Nov-11 6:54
Clive D. Pottinger15-Nov-11 6:54 
GeneralRe: Circular dependency between classes Pin
harold aptroot15-Nov-11 7:01
harold aptroot15-Nov-11 7:01 
GeneralRe: Circular dependency between classes Pin
vinayvraman15-Nov-11 7:52
vinayvraman15-Nov-11 7:52 
GeneralRe: Circular dependency between classes Pin
CDP180216-Nov-11 0:41
CDP180216-Nov-11 0:41 
QuestionFinding a custom event using reflection Pin
Clive D. Pottinger15-Nov-11 4:07
Clive D. Pottinger15-Nov-11 4:07 
Hello Gurus.

Yes, I've painted myself into yet another corner. It seems to be what I do best, so I guess I should stick with it.

This time I am trying use reflection to find an event that I have attached to a class, but reflection is not showing the event. I don't know why.

I have created a simple class called ListPicker that is based on the DomainUpDown control. It is supposed to act just like a DomainUpDown control, but it supports the Modified property and the ModifiedChanged events that DomainUpDown does not. Here is the code:
using System;
using System.Windows.Forms;

namespace WindowsFormsControlLibrary
{
	public partial class ListPicker : DomainUpDown
	{
		public EventHandler ModifiedChanged;

		public ListPicker()
		{
			InitializeComponent();

			// Register our TextChanged hander.
			TextChanged += new EventHandler(ListPicker_TextChanged);

			Modified = false;
		}

		public bool Modified { get; set; }

		public void ListPicker_TextChanged(object sender, EventArgs args)
		{
			Modified = true;
			OnModifiedChanged();
		}

		protected void OnModifiedChanged()
		{
			if (ModifiedChanged != null)
			{
				ModifiedChanged(this, null);
			}				
		}
	}
}

The Modified property works just as I wanted it to, and the ModifiedChanged event fires when it is supposed to, but when I use this code (where ctl is a reference to the ListPicker control)
var x = ctl.GetType().GetEvents();
var modifiedChangedEventInfo = ctl.GetType().GetEvent("ModifiedChanged");

to look for the events on the ListPicker, it does not show the ModifiedChanged event. All the other DomainUpDown event show up in x, but not the ModifiedChanged event and modifiedChangedEventInfo is null

Any ideas? ... and many thanks
Clive Pottinger
Victoria, BC

AnswerRe: Finding a custom event using reflection Pin
CDP180215-Nov-11 4:19
CDP180215-Nov-11 4:19 
AnswerRe: Finding a custom event using reflection Pin
Luc Pattyn15-Nov-11 4:40
sitebuilderLuc Pattyn15-Nov-11 4:40 
GeneralRe: Finding a custom event using reflection Pin
CDP180215-Nov-11 5:02
CDP180215-Nov-11 5:02 
GeneralRe: Finding a custom event using reflection Pin
Clive D. Pottinger15-Nov-11 6:18
Clive D. Pottinger15-Nov-11 6:18 
GeneralRe: Finding a custom event using reflection Pin
Clive D. Pottinger15-Nov-11 15:30
Clive D. Pottinger15-Nov-11 15:30 
AnswerRe: Finding a custom event using reflection Pin
Luc Pattyn15-Nov-11 15:37
sitebuilderLuc Pattyn15-Nov-11 15:37 
GeneralRe: Finding a custom event using reflection Pin
CDP180215-Nov-11 22:14
CDP180215-Nov-11 22:14 
GeneralRe: Finding a custom event using reflection Pin
Wayne Gaylard15-Nov-11 22:35
professionalWayne Gaylard15-Nov-11 22:35 
GeneralRe: Finding a custom event using reflection Pin
CDP180215-Nov-11 22:54
CDP180215-Nov-11 22:54 
GeneralRe: Finding a custom event using reflection Pin
BobJanova16-Nov-11 3:03
BobJanova16-Nov-11 3:03 
QuestionAssigned AppPool resets after completion of Web Deployment Setup when using Custom Actions Pin
www.Developerof.NET15-Nov-11 2:22
www.Developerof.NET15-Nov-11 2:22 
QuestionUnable to add event handler for Minimizing the Ribbon Control in WPF Pin
Kushagra Tiwari15-Nov-11 2:10
Kushagra Tiwari15-Nov-11 2:10 
AnswerRe: Unable to add event handler for Minimizing the Ribbon Control in WPF Pin
JF201515-Nov-11 3:27
JF201515-Nov-11 3:27 
QuestionSynchronous webservice calls briefly freeze up multithreaded application Pin
CDP180215-Nov-11 1:27
CDP180215-Nov-11 1:27 
AnswerRe: Synchronous webservice calls briefly freeze up multithreaded application Pin
BobJanova15-Nov-11 2:41
BobJanova15-Nov-11 2:41 
GeneralRe: Synchronous webservice calls briefly freeze up multithreaded application Pin
CDP180215-Nov-11 3:09
CDP180215-Nov-11 3:09 
QuestionCan anyone explain how this Regex works? Pin
fiaolle14-Nov-11 22:17
fiaolle14-Nov-11 22:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.