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. GetNextControl again ..

GetNextControl again ..

Scheduled Pinned Locked Moved C#
question
3 Posts 2 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.
  • K Offline
    K Offline
    kakarato
    wrote on last edited by
    #1

    I plan to create a custom textbox class that when user press the enter key it will focus to another control. But i would like to check out that, should i place the GetNextControl method in the textbox class or in the base form class :confused:? I found that code below not working .. X| public class baseTextBox:System.Windows.Forms.TextBox { protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Control ctrl = this.GetNextControl(this,true); ctrl.Focus(); e.Handled = true; } } } Please advice. Thanks.

    L 1 Reply Last reply
    0
    • K kakarato

      I plan to create a custom textbox class that when user press the enter key it will focus to another control. But i would like to check out that, should i place the GetNextControl method in the textbox class or in the base form class :confused:? I found that code below not working .. X| public class baseTextBox:System.Windows.Forms.TextBox { protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Control ctrl = this.GetNextControl(this,true); ctrl.Focus(); e.Handled = true; } } } Please advice. Thanks.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      kakarato wrote: Control ctrl = this.GetNextControl(this,true); Dont use this. You are obviously refereing to the container (parent) Control or the Form hosting the control. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

      K 1 Reply Last reply
      0
      • L leppie

        kakarato wrote: Control ctrl = this.GetNextControl(this,true); Dont use this. You are obviously refereing to the container (parent) Control or the Form hosting the control. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

        K Offline
        K Offline
        kakarato
        wrote on last edited by
        #3

        Thanks for help. So i should put the code in a base form class instead of inside the textbox base class right ? Instead of using "this" so what should i use ?

        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