Ok, figured it out.
This article explained it nicely for me Using delegates to communication between windows forms
I'm trying to get my head around using a custom event to pass an updated text for a statusbar in an app I'm building.
I have a bunch of child forms, all of which will send messages to the parent form, in order to update the statusbar.
Now, I know I need to use events but I am a little hazy on generating my own custom events.
An example, someone fills in a form, and on completion, they click OK. The form then processes, adding data to a database - if it is successful, I want it to call an event which says so in the status bar. If not, I want the same event to call, with a different message.
So, as far as I can see, I need to
1. Declare a class for my event
2. Declare a delegate
3. Declare the event in the child forms
4. Call the event
5. Handle the event in the parent form.
However, outside that, I am a little confused. Most tutorials on this I have found just throw code blocks at me without any context (ie. where to put the damned things).
So, could someone shed some light on this for me?
Would this be the same principal with objects?
It's a little easier in Delphi... may just stick to that I think.
There are currently 1 users browsing this thread. (0 members and 1 guests)