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. Raising events in C#

Raising events in C#

Scheduled Pinned Locked Moved C#
csharpquestion
2 Posts 2 Posters 1 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.
  • M Offline
    M Offline
    Mahhouraaaaaa
    wrote on last edited by
    #1

    hello how can i raise an event explicitly using coding for exemple i want to simulate the clicking in a tabpage of the tabcotrol so that it will be showed to the user :D thank you! hope that understand what i mean !!

    L 1 Reply Last reply
    0
    • M Mahhouraaaaaa

      hello how can i raise an event explicitly using coding for exemple i want to simulate the clicking in a tabpage of the tabcotrol so that it will be showed to the user :D thank you! hope that understand what i mean !!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Mahhouraaaaaa wrote:

      how can i raise an event explicitly using coding for exemple i want to simulate the clicking in a tabpage of the tabcotrol so that it will be showed to the user

      To explicitly raise an event in C# you just call the event as it were a method. You first must check to see if it is null. If it were null then there are no registered methods to that event and an exception will be thrown.

      if(Clicked != null)
      Clicked(); //calls all the registered methods "fires the event"

      Your deal with the tab page control is more difficult. If I understood you correctly you want to fire an event of a control from the outside. You will have to send it the ?WM_MOUSECLICK? event, to do that you will need to inject that event into the message queue of Windows itself. You will need to use the native Windows API to do that. There may be other ways, but I am currently unaware of them.

      █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

      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