Coding Thread, Events and Parent MDI forms in Coding and Web Development; I'm trying to get my head around using a custom event to pass an updated text for a statusbar in ...
24th February 2010, 12:09 PM #1
Events and Parent MDI 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?
24th February 2010, 12:42 PM #2
Ok, figured it out.
This article explained it nicely for me Using delegates to communication between windows forms
25th February 2010, 01:13 PM #3
Would this be the same principal with objects?
25th February 2010, 01:15 PM #4
I don't see why not. Forms are effectively just objects after all.
Originally Posted by dwhyte85
25th February 2010, 08:52 PM #5
It's a little easier in Delphi... may just stick to that I think.
By Dos_Box in forum Site Polls
Last Post: 12th March 2010, 06:54 PM
By Dafty in forum How do you do....it?
Last Post: 14th October 2009, 04:44 PM
By DAZZD88 in forum Windows
Last Post: 16th September 2009, 10:25 PM
By limbo in forum Courses and Training
Last Post: 3rd March 2008, 01:02 PM
By beeswax in forum Web Development
Last Post: 28th February 2007, 11:14 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)