Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to call a function...

How to call a function...

Scheduled Pinned Locked Moved C#
csharpquestionc++tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soundman32 2
    wrote on last edited by
    #1

    I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something. The parent window is in a different assembly, and the UserControl knows nothing about the parent. How can I call the parent? In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this? Neil

    A P 2 Replies Last reply
    0
    • S Soundman32 2

      I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something. The parent window is in a different assembly, and the UserControl knows nothing about the parent. How can I call the parent? In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this? Neil

      A Offline
      A Offline
      AB7771
      wrote on last edited by
      #2

      i think u can use the on click event of the control and use the SendMessage(hwnd,wparam,lparam,..) to send a message to the parent window Regards, Pramod

      1 Reply Last reply
      0
      • S Soundman32 2

        I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something. The parent window is in a different assembly, and the UserControl knows nothing about the parent. How can I call the parent? In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this? Neil

        P Offline
        P Offline
        Phil J Pearson
        wrote on last edited by
        #3

        The UserControl needs to raise an event. Any host (parent) can choose to respond to the event if it wants to. This is the .NET way of doing things and it's much better than the old SendMessage way. Look up events and delegates in the documentation.


        The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups