Deriving Form Events

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan Wade

    #1

    Deriving Form Events

    I want to create a base form to derive all my forms from. In the base for I
    want a KeyPress event to fire that when the enter key is pressed it acts
    like the tab key and moves to the next control. How would I set this up in
    my base form and how would I set it ip in forms that derive from it.
    Samples would be great. Thanks

    Ryan


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Deriving Form Events

    Ryan,

    You would have to set the KeyPreview property to true. Then, you would
    override the OnKeyDown and OnKeyUp methods to handle when the enter key was
    pressed, and move the tab focus to the next control.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com

    "Ryan Wade" <test@test.co m> wrote in message
    news:ec%23GmKHe DHA.2304@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    > I want to create a base form to derive all my forms from. In the base for[/color]
    I[color=blue]
    > want a KeyPress event to fire that when the enter key is pressed it acts
    > like the tab key and moves to the next control. How would I set this up[/color]
    in[color=blue]
    > my base form and how would I set it ip in forms that derive from it.
    > Samples would be great. Thanks
    >
    > Ryan
    >
    >[/color]


    Comment

    • Ryan Wade

      #3
      Re: Deriving Form Events

      So if I drive a form from another, the events don't automatically go the the
      derived form? You have to overide them?

      Thanks

      Ryan

      "Nicholas Paldino [.NET/C# MVP]" <nicholas.paldi no@exisconsulti ng.com> wrote
      in message news:uTPL8gJeDH A.2320@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Ryan,
      >
      > You would have to set the KeyPreview property to true. Then, you[/color]
      would[color=blue]
      > override the OnKeyDown and OnKeyUp methods to handle when the enter key[/color]
      was[color=blue]
      > pressed, and move the tab focus to the next control.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - nicholas.paldin o@exisconsultin g.com
      >
      > "Ryan Wade" <test@test.co m> wrote in message
      > news:ec%23GmKHe DHA.2304@TK2MSF TNGP11.phx.gbl. ..[color=green]
      > > I want to create a base form to derive all my forms from. In the base[/color][/color]
      for[color=blue]
      > I[color=green]
      > > want a KeyPress event to fire that when the enter key is pressed it acts
      > > like the tab key and moves to the next control. How would I set this up[/color]
      > in[color=green]
      > > my base form and how would I set it ip in forms that derive from it.
      > > Samples would be great. Thanks
      > >
      > > Ryan
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...