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. calling button click event

calling button click event

Scheduled Pinned Locked Moved C#
7 Posts 5 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.
  • V Offline
    V Offline
    Vivek Vijayan
    wrote on last edited by
    #1

    can i call button_click event from code pictureclick_event() { //from here i want to call button clcik event with out clicking button } buttonclick_event() { }

    This code was posted by me...

    D M P B 4 Replies Last reply
    0
    • V Vivek Vijayan

      can i call button_click event from code pictureclick_event() { //from here i want to call button clcik event with out clicking button } buttonclick_event() { }

      This code was posted by me...

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

      Call the button's PerformClick() method

      Dave
      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
      Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
      Why are you using VB6? Do you hate yourself? (Christian Graus)

      V 1 Reply Last reply
      0
      • V Vivek Vijayan

        can i call button_click event from code pictureclick_event() { //from here i want to call button clcik event with out clicking button } buttonclick_event() { }

        This code was posted by me...

        M Offline
        M Offline
        Mike Ellison
        wrote on last edited by
        #3

        Technically, yes, because an event handler is just a function like any other. But - it may be better in these cases to separate out the code that would be called by multiple event handlers into its own function. Something like this:

        void MyCommonFunction()
        {
        ...
        }

        void PictureClick_Event(o as object, e as EventArgs)
        {
        MyCommonFunction();
        }

        void ButtonClick_Event(o as object, e as EventArgs)
        {
        MyCommonFunction();
        }

        MishaInTheCloud.blogspot.com

        1 Reply Last reply
        0
        • D DaveyM69

          Call the button's PerformClick() method

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
          Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
          Why are you using VB6? Do you hate yourself? (Christian Graus)

          V Offline
          V Offline
          Vivek Vijayan
          wrote on last edited by
          #4

          tnx m doin device application in .net how to close a form and navigate to another form this.close and dispose is not working

          This code was posted by me...

          B 1 Reply Last reply
          0
          • V Vivek Vijayan

            can i call button_click event from code pictureclick_event() { //from here i want to call button clcik event with out clicking button } buttonclick_event() { }

            This code was posted by me...

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            So what's stopping you?

            1 Reply Last reply
            0
            • V Vivek Vijayan

              can i call button_click event from code pictureclick_event() { //from here i want to call button clcik event with out clicking button } buttonclick_event() { }

              This code was posted by me...

              B Offline
              B Offline
              Baeltazor
              wrote on last edited by
              #6

              Hi, I think I understand your question. What you're looking for is this:

              pictureclick_event()
              {
              MySexyButton.PerformClick();
              }

              // The above code will perform a Click on the button without you having to actually click it. Pretty sweet huh? I hope this helps. If you liked the answer I have provided, then please click the 'Good Answer' link on the bottom-right of my post.

              1 Reply Last reply
              0
              • V Vivek Vijayan

                tnx m doin device application in .net how to close a form and navigate to another form this.close and dispose is not working

                This code was posted by me...

                B Offline
                B Offline
                Baeltazor
                wrote on last edited by
                #7

                Vivek Vijayan wrote:

                how to close a form and navigate to another form

                Hi, This code should do it: this.Hide(); Form NewForm = new NewForm(); NewForm.ShowDialog(); I hope this helps.

                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