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. C#:Doubt in event handler?

C#:Doubt in event handler?

Scheduled Pinned Locked Moved C#
csharpdebugginghelpquestion
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.
  • K Offline
    K Offline
    kssknov
    wrote on last edited by
    #1

    hi all i have two forms FORM1 and FORM2.and form1 has two buttons. when buttons B1,B2 is clicked in FORM1, FORM2 should appear, but i need to trace which button is clicked .so that i want to display dfferent controls in FORM2 accordin to button click. Any body give some tips I am trying to trace the "event e" in the FORM2 's load event. pls help

    senthil

    G X 2 Replies Last reply
    0
    • K kssknov

      hi all i have two forms FORM1 and FORM2.and form1 has two buttons. when buttons B1,B2 is clicked in FORM1, FORM2 should appear, but i need to trace which button is clicked .so that i want to display dfferent controls in FORM2 accordin to button click. Any body give some tips I am trying to trace the "event e" in the FORM2 's load event. pls help

      senthil

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      You can either have two event handlers for your two buttons to distinguish which one was pressed or you can examine the sender property by casting it to appropriate type

      #region signature my articles #endregion

      1 Reply Last reply
      0
      • K kssknov

        hi all i have two forms FORM1 and FORM2.and form1 has two buttons. when buttons B1,B2 is clicked in FORM1, FORM2 should appear, but i need to trace which button is clicked .so that i want to display dfferent controls in FORM2 accordin to button click. Any body give some tips I am trying to trace the "event e" in the FORM2 's load event. pls help

        senthil

        X Offline
        X Offline
        Xmen Real
        wrote on last edited by
        #3

        if the event handler is same then use this:

        Button b = (Button)sender;

        now you can indentify the button by "Name", "Text" or any other property

        Becoming Programmer...

        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