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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. To define first clicked button’s...., and second clicked button’s ...., to compare.

To define first clicked button’s...., and second clicked button’s ...., to compare.

Scheduled Pinned Locked Moved C#
tutorialquestion
6 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.
  • O Offline
    O Offline
    omegazafer
    wrote on last edited by
    #1

    How can I get first clicked button’s image and second clicked button’s image in runtime application. (I built the buttons automatically by coding in form loading. I will use tag of button’s image but I can’t define first clicked button’s ... and second clicked button’s.....For example I want to show “perfect” in messagebox if first clicked button’s backgroundimage is the same to second Clicked Buton’s backgroundimage. How can I write first clicked..... and second clicked ..... by coding to compare)

    D C 2 Replies Last reply
    0
    • O omegazafer

      How can I get first clicked button’s image and second clicked button’s image in runtime application. (I built the buttons automatically by coding in form loading. I will use tag of button’s image but I can’t define first clicked button’s ... and second clicked button’s.....For example I want to show “perfect” in messagebox if first clicked button’s backgroundimage is the same to second Clicked Buton’s backgroundimage. How can I write first clicked..... and second clicked ..... by coding to compare)

      D Offline
      D Offline
      DharmarajNagarajan
      wrote on last edited by
      #2

      by checking the status of the button if button1.clicked==true then so and so...

      1 Reply Last reply
      0
      • O omegazafer

        How can I get first clicked button’s image and second clicked button’s image in runtime application. (I built the buttons automatically by coding in form loading. I will use tag of button’s image but I can’t define first clicked button’s ... and second clicked button’s.....For example I want to show “perfect” in messagebox if first clicked button’s backgroundimage is the same to second Clicked Buton’s backgroundimage. How can I write first clicked..... and second clicked ..... by coding to compare)

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        If they handle the same click event, you can use the sender property to access the button that was pressed.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        O 1 Reply Last reply
        0
        • C Christian Graus

          If they handle the same click event, you can use the sender property to access the button that was pressed.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          O Offline
          O Offline
          omegazafer
          wrote on last edited by
          #4

          Thanks for your quick reply, Can you explain it in a small exampe by codes.

          C 1 Reply Last reply
          0
          • O omegazafer

            Thanks for your quick reply, Can you explain it in a small exampe by codes.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            protected void ClickEvent(object sender, eventargs ea) { Button b = sender as Button; // b is now the button that was pressed }

            Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            O 1 Reply Last reply
            0
            • C Christian Graus

              protected void ClickEvent(object sender, eventargs ea) { Button b = sender as Button; // b is now the button that was pressed }

              Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              O Offline
              O Offline
              omegazafer
              wrote on last edited by
              #6

              Thanks, From this how can I indicate first and second clicked buttons. Is this only one button which is clicked? Can you write as codes.(I am beginner to programming)

              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