Click here to Skip to main content
15,914,608 members
Home / Discussions / C#
   

C#

 
GeneralClickety Police Pin
leppie8-Jul-03 9:07
leppie8-Jul-03 9:07 
GeneralMaking one user control aware of another Pin
frogb0x8-Jul-03 7:57
frogb0x8-Jul-03 7:57 
GeneralRe: Making one user control aware of another Pin
leppie8-Jul-03 8:34
leppie8-Jul-03 8:34 
GeneralRe: Making one user control aware of another Pin
Not Active8-Jul-03 9:54
mentorNot Active8-Jul-03 9:54 
GeneralHere's my code so far Pin
frogb0x8-Jul-03 10:32
frogb0x8-Jul-03 10:32 
GeneralRe: Here's my code so far Pin
leppie8-Jul-03 13:34
leppie8-Jul-03 13:34 
GeneralRe: Here's my code so far Pin
frogb0x8-Jul-03 13:35
frogb0x8-Jul-03 13:35 
GeneralRe: Here's my code so far Pin
leppie8-Jul-03 14:05
leppie8-Jul-03 14:05 
frogb0x wrote:
Is there a good primer on Events and the EventHandler() method in general, somewhere?

The ones in MSDN are rather difficult to grasp. It took me quite a while to figure out what they are and why I need them.

To understand events you need to understand delegates. In fact an event is really just a very limited delegate.

A delegate (or function pointer) is basically a function/methods signature. WHat I mean by this is, is that it looks basically like a method but it has the delegate keyword. Think of this as a placeholder for a method.

Example:
delegate void FooHandler(string name);

class ABC
{
  public FooHandler Foo;

  public void InvokeFoo()
  {
    Foo("Hello from ABC");
  }
}

class XYZ
{
  static void MyFoo(string name)
  {
    Console.WriteLine(name);
  }

  static void Main()
  {
    ABC abc = new ABC();
    abc.Foo = new FooHandler(MyFoo);
    abc.InvokeFoo();
  }
}

Now step into this with the debugger, step into every function (F11). This will show you exactly how it works. This allows you specify a method in a different place or you can change them dynamically.

Once you have grasped this, I suggest you look at the MSDN documentation on events.

Hope this helps Smile | :)

leppie::AllocCPArticle(Generic DFA State Machine for .NET);
GeneralSetting form location Pin
mcgahanfl8-Jul-03 7:32
mcgahanfl8-Jul-03 7:32 
GeneralRe: Setting form location Pin
dynamic8-Jul-03 9:40
dynamic8-Jul-03 9:40 
GeneralRe: Setting form location Pin
mcgahanfl8-Jul-03 10:08
mcgahanfl8-Jul-03 10:08 
GeneralCreate Image With Text Pin
Werdna8-Jul-03 6:54
Werdna8-Jul-03 6:54 
GeneralRichTextBox: How to get the count of tabs in a TextLine Pin
STW8-Jul-03 6:17
STW8-Jul-03 6:17 
GeneralRe: RichTextBox: How to get the count of tabs in a TextLine Pin
dynamic8-Jul-03 9:25
dynamic8-Jul-03 9:25 
GeneralRe: RichTextBox: How to get the count of tabs in a TextLine Pin
STW8-Jul-03 10:43
STW8-Jul-03 10:43 
QuestionChanging listview icons? Pin
Manster8-Jul-03 4:57
Manster8-Jul-03 4:57 
GeneralBounds Checker in C# / .NET Pin
NKH8-Jul-03 4:23
NKH8-Jul-03 4:23 
GeneralRe: Bounds Checker in C# / .NET Pin
leppie8-Jul-03 7:41
leppie8-Jul-03 7:41 
GeneralRe: Bounds Checker in C# / .NET Pin
Kant8-Jul-03 16:40
Kant8-Jul-03 16:40 
GeneralRe: Bounds Checker in C# / .NET Pin
Daniel Turini9-Jul-03 4:14
Daniel Turini9-Jul-03 4:14 
GeneralRe: Bounds Checker in C# / .NET Pin
James T. Johnson9-Jul-03 6:14
James T. Johnson9-Jul-03 6:14 
Generalclosing an open form Pin
.gonad8-Jul-03 4:08
.gonad8-Jul-03 4:08 
GeneralRe: closing an open form Pin
zuhx8-Jul-03 10:29
zuhx8-Jul-03 10:29 
GeneralRe: closing an open form Pin
.gonad8-Jul-03 15:46
.gonad8-Jul-03 15:46 
GeneralUpdating a data table Pin
totig8-Jul-03 1:03
totig8-Jul-03 1:03 

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.