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. How can I push a button virtual?

How can I push a button virtual?

Scheduled Pinned Locked Moved C#
questioncsharp
8 Posts 4 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.
  • U Offline
    U Offline
    User 4414712
    wrote on last edited by
    #1

    As the subject is saying, is it possible with C# to push a button like ENTER-key virtual? Just like with InvokeMember("click"), then I just need it to do a virtual push at ENTER-key.

    A D D U 4 Replies Last reply
    0
    • U User 4414712

      As the subject is saying, is it possible with C# to push a button like ENTER-key virtual? Just like with InvokeMember("click"), then I just need it to do a virtual push at ENTER-key.

      A Offline
      A Offline
      Alan N
      wrote on last edited by
      #2

      Hi, The Button class has a PerformClick method. Alan.

      U 2 Replies Last reply
      0
      • A Alan N

        Hi, The Button class has a PerformClick method. Alan.

        U Offline
        U Offline
        User 4414712
        wrote on last edited by
        #3

        Thx a lot

        1 Reply Last reply
        0
        • U User 4414712

          As the subject is saying, is it possible with C# to push a button like ENTER-key virtual? Just like with InvokeMember("click"), then I just need it to do a virtual push at ENTER-key.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          If you have code that does something other than handle speific UI elements in the Button Click handler, you really need to move that code to it's own method. Then you can call it from both the Button Click handler and from anywhere else in your code without having to resort to funky workarounds like this.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          1 Reply Last reply
          0
          • A Alan N

            Hi, The Button class has a PerformClick method. Alan.

            U Offline
            U Offline
            User 4414712
            wrote on last edited by
            #5

            Hmm, and how can I then use it to make a push on Enter at my keyboard ? As I see that class, it only can perform clicks on buttons on the application. What I want is to make a program that for examples makes a virtual push on A,B,C,D,E,F,G on my keyboard

            1 Reply Last reply
            0
            • U User 4414712

              As the subject is saying, is it possible with C# to push a button like ENTER-key virtual? Just like with InvokeMember("click"), then I just need it to do a virtual push at ENTER-key.

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

              Are you looking for SendKeys[^]?

              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)

              U 1 Reply Last reply
              0
              • D DaveyM69

                Are you looking for SendKeys[^]?

                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)

                U Offline
                U Offline
                User 4414712
                wrote on last edited by
                #7

                Yes, I believe it is that I am looking for :)

                1 Reply Last reply
                0
                • U User 4414712

                  As the subject is saying, is it possible with C# to push a button like ENTER-key virtual? Just like with InvokeMember("click"), then I just need it to do a virtual push at ENTER-key.

                  U Offline
                  U Offline
                  User 4414712
                  wrote on last edited by
                  #8

                  That works fine with SendKey, but it just requires that focus is on the application.. Which it isnt all the time.. Else it just does a Enter push while i am in another program.. Can I do so it does the ENTER in my application, and not in my current open program?

                  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