treeView keydown

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hrvoje Voda

    treeView keydown

    What is wrong in this code?

    private void tree_KeyDown(ob ject sender, System.Windows. Forms.KeyEventA rgs
    e)

    {

    if (e.KeyCode == Keys.Enter )

    {

    ConnString = "workstatio n id=HRV;packet size=4096;integ rated
    security=SSPI;d ata source=HRV;pers ist security info=False;init ial
    catalog=DVD Kolekcija";

    bDb = new Db(ConnString);

    grid.Refresh();


    grid.Table = bDb.datasetDVD. Tables ["DVD"];

    }

    }



    I press ENTER when I'm on treeview control but nothing happens!



    Hrcko


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: treeView keydown

    Hrvoje,

    I would step through the code, and see if an exception is thrown
    anywhere. If an exception is thrown, it will be swallowed by the code
    calling your event handler, and do nothing.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Hrvoje Voda" <hrvoje.voda@lu atech.com> wrote in message
    news:d1s0d7$bhv $1@ls219.htnet. hr...[color=blue]
    > What is wrong in this code?
    >
    > private void tree_KeyDown(ob ject sender, System.Windows. Forms.KeyEventA rgs
    > e)
    >
    > {
    >
    > if (e.KeyCode == Keys.Enter )
    >
    > {
    >
    > ConnString = "workstatio n id=HRV;packet size=4096;integ rated
    > security=SSPI;d ata source=HRV;pers ist security info=False;init ial
    > catalog=DVD Kolekcija";
    >
    > bDb = new Db(ConnString);
    >
    > grid.Refresh();
    >
    >
    > grid.Table = bDb.datasetDVD. Tables ["DVD"];
    >
    > }
    >
    > }
    >
    >
    >
    > I press ENTER when I'm on treeview control but nothing happens!
    >
    >
    >
    > Hrcko
    >
    >[/color]


    Comment

    • Ludovic SOEUR

      #3
      Re: treeView keydown

      Nothing is wrong with your code. Enter key is already used for an other
      control (for example, if you set an accetButton for your form). The solution
      is to says to the control that Enter key is an input key.

      To do so, override TreeView class like following :
      class TreeView2:TreeV iew {
      protected override bool IsInputKey(Keys keyData) {
      if (keyData==Keys. Enter) return true;
      return base.IsInputKey (keyData);
      }
      }

      Note that if you want to catch other keys like TAB, you can use a switch
      statement. And if you want to catch ALL keys, always return true in
      IsInputKey method.

      And do not forget to replace
      System.Windows. Form.TreeView tree;
      par
      TreeView2 tree;

      et de même
      tree=new System.Windows. Form.TreeView() ;
      par
      tree=new TreeView2();


      Hope it helps,

      Ludovic Soeur.

      "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
      news:d1s0d7$bhv $1@ls219.htnet. hr...[color=blue]
      > What is wrong in this code?
      >
      > private void tree_KeyDown(ob ject sender, System.Windows. Forms.KeyEventA rgs
      > e)
      >
      > {
      >
      > if (e.KeyCode == Keys.Enter )
      >
      > {
      >
      > ConnString = "workstatio n id=HRV;packet size=4096;integ rated
      > security=SSPI;d ata source=HRV;pers ist security info=False;init ial
      > catalog=DVD Kolekcija";
      >
      > bDb = new Db(ConnString);
      >
      > grid.Refresh();
      >
      >
      > grid.Table = bDb.datasetDVD. Tables ["DVD"];
      >
      > }
      >
      > }
      >
      >
      >
      > I press ENTER when I'm on treeview control but nothing happens!
      >
      >
      >
      > Hrcko
      >
      >[/color]


      Comment

      • Hrvoje Voda

        #4
        Re: treeView keydown

        I have a problem with overriding, because I'm using my user control.
        I created some aditional functions for it, so when I put this code I can't
        access my own functions!

        Hrcko


        "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
        news:OvXvktEMFH A.3632@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Nothing is wrong with your code. Enter key is already used for an other
        > control (for example, if you set an accetButton for your form). The
        > solution
        > is to says to the control that Enter key is an input key.
        >
        > To do so, override TreeView class like following :
        > class TreeView2:TreeV iew {
        > protected override bool IsInputKey(Keys keyData) {
        > if (keyData==Keys. Enter) return true;
        > return base.IsInputKey (keyData);
        > }
        > }
        >
        > Note that if you want to catch other keys like TAB, you can use a switch
        > statement. And if you want to catch ALL keys, always return true in
        > IsInputKey method.
        >
        > And do not forget to replace
        > System.Windows. Form.TreeView tree;
        > par
        > TreeView2 tree;
        >
        > et de même
        > tree=new System.Windows. Form.TreeView() ;
        > par
        > tree=new TreeView2();
        >
        >
        > Hope it helps,
        >
        > Ludovic Soeur.
        >
        > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
        > news:d1s0d7$bhv $1@ls219.htnet. hr...[color=green]
        >> What is wrong in this code?
        >>
        >> private void tree_KeyDown(ob ject sender,
        >> System.Windows. Forms.KeyEventA rgs
        >> e)
        >>
        >> {
        >>
        >> if (e.KeyCode == Keys.Enter )
        >>
        >> {
        >>
        >> ConnString = "workstatio n id=HRV;packet size=4096;integ rated
        >> security=SSPI;d ata source=HRV;pers ist security info=False;init ial
        >> catalog=DVD Kolekcija";
        >>
        >> bDb = new Db(ConnString);
        >>
        >> grid.Refresh();
        >>
        >>
        >> grid.Table = bDb.datasetDVD. Tables ["DVD"];
        >>
        >> }
        >>
        >> }
        >>
        >>
        >>
        >> I press ENTER when I'm on treeview control but nothing happens!
        >>
        >>
        >>
        >> Hrcko
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Ludovic SOEUR

          #5
          Re: treeView keydown

          If I have understood, you have already overloaded TreeView, so just put
          IsInputKey method in your overloaded control.
          If I didn't, show me your code.

          Ludovic Soeur.


          "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
          news:d1tv3d$oe2 $1@ss405.t-com.hr...[color=blue]
          > I have a problem with overriding, because I'm using my user control.
          > I created some aditional functions for it, so when I put this code I can't
          > access my own functions!
          >
          > Hrcko
          >
          >
          > "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
          > news:OvXvktEMFH A.3632@TK2MSFTN GP10.phx.gbl...[color=green]
          > > Nothing is wrong with your code. Enter key is already used for an other
          > > control (for example, if you set an accetButton for your form). The
          > > solution
          > > is to says to the control that Enter key is an input key.
          > >
          > > To do so, override TreeView class like following :
          > > class TreeView2:TreeV iew {
          > > protected override bool IsInputKey(Keys keyData) {
          > > if (keyData==Keys. Enter) return true;
          > > return base.IsInputKey (keyData);
          > > }
          > > }
          > >
          > > Note that if you want to catch other keys like TAB, you can use a switch
          > > statement. And if you want to catch ALL keys, always return true in
          > > IsInputKey method.
          > >
          > > And do not forget to replace
          > > System.Windows. Form.TreeView tree;
          > > par
          > > TreeView2 tree;
          > >
          > > et de même
          > > tree=new System.Windows. Form.TreeView() ;
          > > par
          > > tree=new TreeView2();
          > >
          > >
          > > Hope it helps,
          > >
          > > Ludovic Soeur.
          > >
          > > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
          > > news:d1s0d7$bhv $1@ls219.htnet. hr...[color=darkred]
          > >> What is wrong in this code?
          > >>
          > >> private void tree_KeyDown(ob ject sender,
          > >> System.Windows. Forms.KeyEventA rgs
          > >> e)
          > >>
          > >> {
          > >>
          > >> if (e.KeyCode == Keys.Enter )
          > >>
          > >> {
          > >>
          > >> ConnString = "workstatio n id=HRV;packet size=4096;integ rated
          > >> security=SSPI;d ata source=HRV;pers ist security info=False;init ial
          > >> catalog=DVD Kolekcija";
          > >>
          > >> bDb = new Db(ConnString);
          > >>
          > >> grid.Refresh();
          > >>
          > >>
          > >> grid.Table = bDb.datasetDVD. Tables ["DVD"];
          > >>
          > >> }
          > >>
          > >> }
          > >>
          > >>
          > >>
          > >> I press ENTER when I'm on treeview control but nothing happens!
          > >>
          > >>
          > >>
          > >> Hrcko
          > >>
          > >>[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Hrvoje Voda

            #6
            Re: treeView keydown

            I put IsInputKey method in my user control, but it still doesn't work!
            Should I call it somehow in my other application?

            Hrcko


            "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
            news:%236llvmFM FHA.2132@TK2MSF TNGP14.phx.gbl. ..[color=blue]
            > If I have understood, you have already overloaded TreeView, so just put
            > IsInputKey method in your overloaded control.
            > If I didn't, show me your code.
            >
            > Ludovic Soeur.
            >
            >
            > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
            > news:d1tv3d$oe2 $1@ss405.t-com.hr...[color=green]
            >> I have a problem with overriding, because I'm using my user control.
            >> I created some aditional functions for it, so when I put this code I
            >> can't
            >> access my own functions!
            >>
            >> Hrcko
            >>
            >>
            >> "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
            >> news:OvXvktEMFH A.3632@TK2MSFTN GP10.phx.gbl...[color=darkred]
            >> > Nothing is wrong with your code. Enter key is already used for an other
            >> > control (for example, if you set an accetButton for your form). The
            >> > solution
            >> > is to says to the control that Enter key is an input key.
            >> >
            >> > To do so, override TreeView class like following :
            >> > class TreeView2:TreeV iew {
            >> > protected override bool IsInputKey(Keys keyData) {
            >> > if (keyData==Keys. Enter) return true;
            >> > return base.IsInputKey (keyData);
            >> > }
            >> > }
            >> >
            >> > Note that if you want to catch other keys like TAB, you can use a
            >> > switch
            >> > statement. And if you want to catch ALL keys, always return true in
            >> > IsInputKey method.
            >> >
            >> > And do not forget to replace
            >> > System.Windows. Form.TreeView tree;
            >> > par
            >> > TreeView2 tree;
            >> >
            >> > et de même
            >> > tree=new System.Windows. Form.TreeView() ;
            >> > par
            >> > tree=new TreeView2();
            >> >
            >> >
            >> > Hope it helps,
            >> >
            >> > Ludovic Soeur.
            >> >
            >> > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
            >> > news:d1s0d7$bhv $1@ls219.htnet. hr...
            >> >> What is wrong in this code?
            >> >>
            >> >> private void tree_KeyDown(ob ject sender,
            >> >> System.Windows. Forms.KeyEventA rgs
            >> >> e)
            >> >>
            >> >> {
            >> >>
            >> >> if (e.KeyCode == Keys.Enter )
            >> >>
            >> >> {
            >> >>
            >> >> ConnString = "workstatio n id=HRV;packet size=4096;integ rated
            >> >> security=SSPI;d ata source=HRV;pers ist security info=False;init ial
            >> >> catalog=DVD Kolekcija";
            >> >>
            >> >> bDb = new Db(ConnString);
            >> >>
            >> >> grid.Refresh();
            >> >>
            >> >>
            >> >> grid.Table = bDb.datasetDVD. Tables ["DVD"];
            >> >>
            >> >> }
            >> >>
            >> >> }
            >> >>
            >> >>
            >> >>
            >> >> I press ENTER when I'm on treeview control but nothing happens!
            >> >>
            >> >>
            >> >>
            >> >> Hrcko
            >> >>
            >> >>
            >> >
            >> >[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            • Ludovic SOEUR

              #7
              Re: treeView keydown

              Show me your code...

              "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
              news:d1u8ti$cno $1@ss405.t-com.hr...[color=blue]
              > I put IsInputKey method in my user control, but it still doesn't work!
              > Should I call it somehow in my other application?
              >
              > Hrcko
              >
              >
              > "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
              > news:%236llvmFM FHA.2132@TK2MSF TNGP14.phx.gbl. ..[color=green]
              > > If I have understood, you have already overloaded TreeView, so just put
              > > IsInputKey method in your overloaded control.
              > > If I didn't, show me your code.
              > >
              > > Ludovic Soeur.
              > >
              > >
              > > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
              > > news:d1tv3d$oe2 $1@ss405.t-com.hr...[color=darkred]
              > >> I have a problem with overriding, because I'm using my user control.
              > >> I created some aditional functions for it, so when I put this code I
              > >> can't
              > >> access my own functions!
              > >>
              > >> Hrcko
              > >>
              > >>
              > >> "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
              > >> news:OvXvktEMFH A.3632@TK2MSFTN GP10.phx.gbl...
              > >> > Nothing is wrong with your code. Enter key is already used for an[/color][/color][/color]
              other[color=blue][color=green][color=darkred]
              > >> > control (for example, if you set an accetButton for your form). The
              > >> > solution
              > >> > is to says to the control that Enter key is an input key.
              > >> >
              > >> > To do so, override TreeView class like following :
              > >> > class TreeView2:TreeV iew {
              > >> > protected override bool IsInputKey(Keys keyData) {
              > >> > if (keyData==Keys. Enter) return true;
              > >> > return base.IsInputKey (keyData);
              > >> > }
              > >> > }
              > >> >
              > >> > Note that if you want to catch other keys like TAB, you can use a
              > >> > switch
              > >> > statement. And if you want to catch ALL keys, always return true in
              > >> > IsInputKey method.
              > >> >
              > >> > And do not forget to replace
              > >> > System.Windows. Form.TreeView tree;
              > >> > par
              > >> > TreeView2 tree;
              > >> >
              > >> > et de même
              > >> > tree=new System.Windows. Form.TreeView() ;
              > >> > par
              > >> > tree=new TreeView2();
              > >> >
              > >> >
              > >> > Hope it helps,
              > >> >
              > >> > Ludovic Soeur.
              > >> >
              > >> > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
              > >> > news:d1s0d7$bhv $1@ls219.htnet. hr...
              > >> >> What is wrong in this code?
              > >> >>
              > >> >> private void tree_KeyDown(ob ject sender,
              > >> >> System.Windows. Forms.KeyEventA rgs
              > >> >> e)
              > >> >>
              > >> >> {
              > >> >>
              > >> >> if (e.KeyCode == Keys.Enter )
              > >> >>
              > >> >> {
              > >> >>
              > >> >> ConnString = "workstatio n id=HRV;packet size=4096;integ rated
              > >> >> security=SSPI;d ata source=HRV;pers ist security info=False;init ial
              > >> >> catalog=DVD Kolekcija";
              > >> >>
              > >> >> bDb = new Db(ConnString);
              > >> >>
              > >> >> grid.Refresh();
              > >> >>
              > >> >>
              > >> >> grid.Table = bDb.datasetDVD. Tables ["DVD"];
              > >> >>
              > >> >> }
              > >> >>
              > >> >> }
              > >> >>
              > >> >>
              > >> >>
              > >> >> I press ENTER when I'm on treeview control but nothing happens!
              > >> >>
              > >> >>
              > >> >>
              > >> >> Hrcko
              > >> >>
              > >> >>
              > >> >
              > >> >
              > >>
              > >>[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Hrvoje Voda

                #8
                Re: treeView keydown

                In my application I have my user control and this code :

                in constructor :

                treeKolekcija.K eyDown += new KeyEventHandler (tree_KeyDown) ;



                private void tree_KeyDown(ob ject sender, System.Windows. Forms.KeyEventA rgs
                e)
                {
                if (e.KeyCode == Keys.Enter )
                {
                ConnString = "workstatio n id=HRV;packet size=4096;integ rated
                security=SSPI;d ata source=HRV;pers ist security info=False;init ial
                catalog=DVD Kolekcija";
                bDb = new Db(ConnString);
                grid.Refresh();
                grid.Table = bDb.datasetDVD. Tables ["DVD"];
                }
                }

                I put your code into my user control :

                protected override bool IsInputKey(Keys keyData)
                {
                if (keyData==Keys. Enter) return true;
                return base.IsInputKey (keyData);
                }



                "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
                news:Oi5b1CHMFH A.1096@tk2msftn gp13.phx.gbl...[color=blue]
                > Show me your code...
                >
                > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                > news:d1u8ti$cno $1@ss405.t-com.hr...[color=green]
                >> I put IsInputKey method in my user control, but it still doesn't work!
                >> Should I call it somehow in my other application?
                >>
                >> Hrcko
                >>
                >>
                >> "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
                >> news:%236llvmFM FHA.2132@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
                >> > If I have understood, you have already overloaded TreeView, so just put
                >> > IsInputKey method in your overloaded control.
                >> > If I didn't, show me your code.
                >> >
                >> > Ludovic Soeur.
                >> >
                >> >
                >> > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                >> > news:d1tv3d$oe2 $1@ss405.t-com.hr...
                >> >> I have a problem with overriding, because I'm using my user control.
                >> >> I created some aditional functions for it, so when I put this code I
                >> >> can't
                >> >> access my own functions!
                >> >>
                >> >> Hrcko
                >> >>
                >> >>
                >> >> "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
                >> >> news:OvXvktEMFH A.3632@TK2MSFTN GP10.phx.gbl...
                >> >> > Nothing is wrong with your code. Enter key is already used for an[/color][/color]
                > other[color=green][color=darkred]
                >> >> > control (for example, if you set an accetButton for your form). The
                >> >> > solution
                >> >> > is to says to the control that Enter key is an input key.
                >> >> >
                >> >> > To do so, override TreeView class like following :
                >> >> > class TreeView2:TreeV iew {
                >> >> > protected override bool IsInputKey(Keys keyData) {
                >> >> > if (keyData==Keys. Enter) return true;
                >> >> > return base.IsInputKey (keyData);
                >> >> > }
                >> >> > }
                >> >> >
                >> >> > Note that if you want to catch other keys like TAB, you can use a
                >> >> > switch
                >> >> > statement. And if you want to catch ALL keys, always return true in
                >> >> > IsInputKey method.
                >> >> >
                >> >> > And do not forget to replace
                >> >> > System.Windows. Form.TreeView tree;
                >> >> > par
                >> >> > TreeView2 tree;
                >> >> >
                >> >> > et de même
                >> >> > tree=new System.Windows. Form.TreeView() ;
                >> >> > par
                >> >> > tree=new TreeView2();
                >> >> >
                >> >> >
                >> >> > Hope it helps,
                >> >> >
                >> >> > Ludovic Soeur.
                >> >> >
                >> >> > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                >> >> > news:d1s0d7$bhv $1@ls219.htnet. hr...
                >> >> >> What is wrong in this code?
                >> >> >>
                >> >> >> private void tree_KeyDown(ob ject sender,
                >> >> >> System.Windows. Forms.KeyEventA rgs
                >> >> >> e)
                >> >> >>
                >> >> >> {
                >> >> >>
                >> >> >> if (e.KeyCode == Keys.Enter )
                >> >> >>
                >> >> >> {
                >> >> >>
                >> >> >> ConnString = "workstatio n id=HRV;packet size=4096;integ rated
                >> >> >> security=SSPI;d ata source=HRV;pers ist security info=False;init ial
                >> >> >> catalog=DVD Kolekcija";
                >> >> >>
                >> >> >> bDb = new Db(ConnString);
                >> >> >>
                >> >> >> grid.Refresh();
                >> >> >>
                >> >> >>
                >> >> >> grid.Table = bDb.datasetDVD. Tables ["DVD"];
                >> >> >>
                >> >> >> }
                >> >> >>
                >> >> >> }
                >> >> >>
                >> >> >>
                >> >> >>
                >> >> >> I press ENTER when I'm on treeview control but nothing happens!
                >> >> >>
                >> >> >>
                >> >> >>
                >> >> >> Hrcko
                >> >> >>
                >> >> >>
                >> >> >
                >> >> >
                >> >>
                >> >>
                >> >
                >> >[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • Ludovic SOEUR

                  #9
                  Re: treeView keydown

                  This is how you must change your code :

                  namespace MonNameSpace {
                  public class MyUserControl : UserControl {
                  ....
                  ....
                  TreeView2 treeKolekcija;
                  ....
                  ....
                  ....
                  private void InitializeCompo nent() {
                  ...
                  ...
                  this.treeKolekc ija = new TreeView2();
                  ...
                  ...
                  }
                  ...
                  ...
                  private void tree_KeyDown(ob ject sender,
                  System.Windows. Forms.KeyEventA rgs e) {
                  ...
                  your code
                  ...
                  }
                  ...
                  ...
                  }
                  class TreeView2:TreeV iew {
                  protected override bool IsInputKey(Keys keyData) {
                  if (keyData==Keys. Enter) return true;
                  return base.IsInputKey (keyData);
                  }
                  }
                  }

                  Of course, if you have already overloaded TreeView Class, do not extend
                  TreeView2 from TreeView but from your own TreeView class.

                  Hope it helps...
                  If it does not, I would send you a complete example.

                  Ludovic Soeur.

                  "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                  news:d20hbk$pra $1@ss405.t-com.hr...[color=blue]
                  > In my application I have my user control and this code :
                  >
                  > in constructor :
                  >
                  > treeKolekcija.K eyDown += new KeyEventHandler (tree_KeyDown) ;
                  >
                  >
                  >
                  > private void tree_KeyDown(ob ject sender,[/color]
                  System.Windows. Forms.KeyEventA rgs[color=blue]
                  > e)
                  > {
                  > if (e.KeyCode == Keys.Enter )
                  > {
                  > ConnString = "workstatio n id=HRV;packet size=4096;integ rated
                  > security=SSPI;d ata source=HRV;pers ist security info=False;init ial
                  > catalog=DVD Kolekcija";
                  > bDb = new Db(ConnString);
                  > grid.Refresh();
                  > grid.Table = bDb.datasetDVD. Tables ["DVD"];
                  > }
                  > }
                  >
                  > I put your code into my user control :
                  >
                  > protected override bool IsInputKey(Keys keyData)
                  > {
                  > if (keyData==Keys. Enter) return true;
                  > return base.IsInputKey (keyData);
                  > }
                  >
                  >
                  >
                  > "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
                  > news:Oi5b1CHMFH A.1096@tk2msftn gp13.phx.gbl...[color=green]
                  > > Show me your code...
                  > >
                  > > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                  > > news:d1u8ti$cno $1@ss405.t-com.hr...[color=darkred]
                  > >> I put IsInputKey method in my user control, but it still doesn't work!
                  > >> Should I call it somehow in my other application?
                  > >>
                  > >> Hrcko
                  > >>
                  > >>
                  > >> "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
                  > >> news:%236llvmFM FHA.2132@TK2MSF TNGP14.phx.gbl. ..
                  > >> > If I have understood, you have already overloaded TreeView, so just[/color][/color][/color]
                  put[color=blue][color=green][color=darkred]
                  > >> > IsInputKey method in your overloaded control.
                  > >> > If I didn't, show me your code.
                  > >> >
                  > >> > Ludovic Soeur.
                  > >> >
                  > >> >
                  > >> > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                  > >> > news:d1tv3d$oe2 $1@ss405.t-com.hr...
                  > >> >> I have a problem with overriding, because I'm using my user control.
                  > >> >> I created some aditional functions for it, so when I put this code I
                  > >> >> can't
                  > >> >> access my own functions!
                  > >> >>
                  > >> >> Hrcko
                  > >> >>
                  > >> >>
                  > >> >> "Ludovic SOEUR" <Ludovic_SOEUR@ hotmail.com> wrote in message
                  > >> >> news:OvXvktEMFH A.3632@TK2MSFTN GP10.phx.gbl...
                  > >> >> > Nothing is wrong with your code. Enter key is already used for an[/color]
                  > > other[color=darkred]
                  > >> >> > control (for example, if you set an accetButton for your form).[/color][/color][/color]
                  The[color=blue][color=green][color=darkred]
                  > >> >> > solution
                  > >> >> > is to says to the control that Enter key is an input key.
                  > >> >> >
                  > >> >> > To do so, override TreeView class like following :
                  > >> >> > class TreeView2:TreeV iew {
                  > >> >> > protected override bool IsInputKey(Keys keyData) {
                  > >> >> > if (keyData==Keys. Enter) return true;
                  > >> >> > return base.IsInputKey (keyData);
                  > >> >> > }
                  > >> >> > }
                  > >> >> >
                  > >> >> > Note that if you want to catch other keys like TAB, you can use a
                  > >> >> > switch
                  > >> >> > statement. And if you want to catch ALL keys, always return true[/color][/color][/color]
                  in[color=blue][color=green][color=darkred]
                  > >> >> > IsInputKey method.
                  > >> >> >
                  > >> >> > And do not forget to replace
                  > >> >> > System.Windows. Form.TreeView tree;
                  > >> >> > par
                  > >> >> > TreeView2 tree;
                  > >> >> >
                  > >> >> > et de même
                  > >> >> > tree=new System.Windows. Form.TreeView() ;
                  > >> >> > par
                  > >> >> > tree=new TreeView2();
                  > >> >> >
                  > >> >> >
                  > >> >> > Hope it helps,
                  > >> >> >
                  > >> >> > Ludovic Soeur.
                  > >> >> >
                  > >> >> > "Hrvoje Voda" <hrvoje.voda@lu atech.com> a écrit dans le message de
                  > >> >> > news:d1s0d7$bhv $1@ls219.htnet. hr...
                  > >> >> >> What is wrong in this code?
                  > >> >> >>
                  > >> >> >> private void tree_KeyDown(ob ject sender,
                  > >> >> >> System.Windows. Forms.KeyEventA rgs
                  > >> >> >> e)
                  > >> >> >>
                  > >> >> >> {
                  > >> >> >>
                  > >> >> >> if (e.KeyCode == Keys.Enter )
                  > >> >> >>
                  > >> >> >> {
                  > >> >> >>
                  > >> >> >> ConnString = "workstatio n id=HRV;packet size=4096;integ rated
                  > >> >> >> security=SSPI;d ata source=HRV;pers ist security info=False;init ial
                  > >> >> >> catalog=DVD Kolekcija";
                  > >> >> >>
                  > >> >> >> bDb = new Db(ConnString);
                  > >> >> >>
                  > >> >> >> grid.Refresh();
                  > >> >> >>
                  > >> >> >>
                  > >> >> >> grid.Table = bDb.datasetDVD. Tables ["DVD"];
                  > >> >> >>
                  > >> >> >> }
                  > >> >> >>
                  > >> >> >> }
                  > >> >> >>
                  > >> >> >>
                  > >> >> >>
                  > >> >> >> I press ENTER when I'm on treeview control but nothing happens!
                  > >> >> >>
                  > >> >> >>
                  > >> >> >>
                  > >> >> >> Hrcko
                  > >> >> >>
                  > >> >> >>
                  > >> >> >
                  > >> >> >
                  > >> >>
                  > >> >>
                  > >> >
                  > >> >
                  > >>
                  > >>[/color]
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  Working...