+ Post New Thread
Results 1 to 5 of 5
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 ...
  1. #1

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,680
    Thank Post
    516
    Thanked 2,451 Times in 1,897 Posts
    Blog Entries
    24
    Rep Power
    832

    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?

  2. #2

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,680
    Thank Post
    516
    Thanked 2,451 Times in 1,897 Posts
    Blog Entries
    24
    Rep Power
    832
    Ok, figured it out.

    This article explained it nicely for me Using delegates to communication between windows forms

  3. #3
    dwhyte85's Avatar
    Join Date
    Mar 2009
    Location
    Berkshire
    Posts
    1,219
    Thank Post
    159
    Thanked 147 Times in 132 Posts
    Rep Power
    103
    Would this be the same principal with objects?

  4. #4

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,680
    Thank Post
    516
    Thanked 2,451 Times in 1,897 Posts
    Blog Entries
    24
    Rep Power
    832
    Quote Originally Posted by dwhyte85 View Post
    Would this be the same principal with objects?
    I don't see why not. Forms are effectively just objects after all.

  5. #5
    dwhyte85's Avatar
    Join Date
    Mar 2009
    Location
    Berkshire
    Posts
    1,219
    Thank Post
    159
    Thanked 147 Times in 132 Posts
    Rep Power
    103
    It's a little easier in Delphi... may just stick to that I think.

SHARE:
+ Post New Thread

Similar Threads

  1. What conferences\events are you going to go to?
    By Dos_Box in forum Site Polls
    Replies: 30
    Last Post: 12th March 2010, 05:54 PM
  2. Ticketing for Events
    By Dafty in forum How do you do....it?
    Replies: 2
    Last Post: 14th October 2009, 03:44 PM
  3. Events 5719, 14 and 29
    By DAZZD88 in forum Windows
    Replies: 3
    Last Post: 16th September 2009, 09:25 PM
  4. Birmingham LA Events
    By limbo in forum Courses and Training
    Replies: 10
    Last Post: 3rd March 2008, 12:02 PM
  5. forms
    By beeswax in forum Web Development
    Replies: 5
    Last Post: 28th February 2007, 10:14 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •