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. Visual Basic
  4. Raising event from objects within a controls collection

Raising event from objects within a controls collection

Scheduled Pinned Locked Moved Visual Basic
helpwinformstutorialquestion
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.
  • D Offline
    D Offline
    Damage_Inc
    wrote on last edited by
    #1

    Hi. I need some help. I'm trying to add user controls dynamically to a tabpage's controls collection. The problem is, once they've been added, i don't know how to listen for events raised within the user controls. Is there some control-object event handler? HELLLP. Thanks in advance. DI

    R J 2 Replies Last reply
    0
    • D Damage_Inc

      Hi. I need some help. I'm trying to add user controls dynamically to a tabpage's controls collection. The problem is, once they've been added, i don't know how to listen for events raised within the user controls. Is there some control-object event handler? HELLLP. Thanks in advance. DI

      R Offline
      R Offline
      Ray Cassick
      wrote on last edited by
      #2

      Take a look in the help for addhandler. This should do the trick for you.


      Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.


      1 Reply Last reply
      0
      • D Damage_Inc

        Hi. I need some help. I'm trying to add user controls dynamically to a tabpage's controls collection. The problem is, once they've been added, i don't know how to listen for events raised within the user controls. Is there some control-object event handler? HELLLP. Thanks in advance. DI

        J Offline
        J Offline
        J Dunlap
        wrote on last edited by
        #3

        Events are handled in a good new way in .NET. When you want to listen to an event, you do this:

        button.Click += new System.EventHandler(buttonClick)

        where button.Click is the event, and buttonClick is a method with the correct arguments. When handling multiple controls' events, use the "Sender As Object" argument of the method you assigned to the event to find out which object fired the event.

        "Do unto others as you would have them do unto you." - Jesus
        "An eye for an eye only makes the whole world blind." - Mahatma Gandhi

        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