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. invoke DoubleClick event

invoke DoubleClick event

Scheduled Pinned Locked Moved C#
questioncsharp
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.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I have gridPatients_DoubleClick in my application which has a code inside it. I want to use the same code in gridPatients_KeyDown using C#, How can I call the gridPatients_DoubleClick from gridPatients_KeyDown?

    J 1 Reply Last reply
    0
    • J Jassim Rahma

      Hi, I have gridPatients_DoubleClick in my application which has a code inside it. I want to use the same code in gridPatients_KeyDown using C#, How can I call the gridPatients_DoubleClick from gridPatients_KeyDown?

      J Offline
      J Offline
      JF2015
      wrote on last edited by
      #2

      Try the following approach - anything else is unclean:

      private void gridPatients_DoubleClick(object sender, System.EventArgs e)
      {
      DoStuff();
      }

      private void gridPatients_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
      {
      DoStuff();
      }

      private void DoStuff()
      {
      //do the things that you want to do in KeyDown and DoubleClick
      }

      B 1 Reply Last reply
      0
      • J JF2015

        Try the following approach - anything else is unclean:

        private void gridPatients_DoubleClick(object sender, System.EventArgs e)
        {
        DoStuff();
        }

        private void gridPatients_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
        DoStuff();
        }

        private void DoStuff()
        {
        //do the things that you want to do in KeyDown and DoubleClick
        }

        B Offline
        B Offline
        BobJanova
        wrote on last edited by
        #3

        Quite right. Although the key down handler should be

        private void gridPatients_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
        if(the key was the one you wanted)
        DoStuff();
        }

        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