Focus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick De Ridder

    #1

    Focus

    I have a form with a number of text boxes. When I start the program I
    want the cursor to be in one particular text box. I have tried
    textbox4.Focus( ); in the constructor, but that doesn't do the trick.
    How should it be done?
    Many thanks,
    --
    Patrick De Ridder
    ngmail@freeler. nl
  • 100

    #2
    Re: Focus

    Hi Patrik
    Try to set Textboxes' TabIndex properties properly. The text box with tab
    index 0 should have the focus when you start the form. Make sure TabStop is
    set to true for all text boxes

    HTH
    B\rgds
    100

    "Patrick De Ridder" <ngmail@freeler .nl> wrote in message
    news:a3okjvsv6u sb49c691ck3vs1r 1kl4ml5gk@4ax.c om...[color=blue]
    > I have a form with a number of text boxes. When I start the program I
    > want the cursor to be in one particular text box. I have tried
    > textbox4.Focus( ); in the constructor, but that doesn't do the trick.
    > How should it be done?
    > Many thanks,
    > --
    > Patrick De Ridder
    > ngmail@freeler. nl[/color]


    Comment

    • Patrick De Ridder

      #3
      Re: Focus

      100 <100@100.com> wrote in message
      news:#weULebYDH A.1916@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Hi Patrik
      > Try to set Textboxes' TabIndex properties properly. The text box with tab
      > index 0 should have the focus when you start the form. Make sure TabStop[/color]
      is[color=blue]
      > set to true for all text boxes[/color]

      Thanks! I will do that.
      Btw what does TabStop do?
      --
      Patrick


      Comment

      • Wim Hollebrandse

        #4
        Re: Focus

        Alternatively, you can call the .Focus() method from within the Form_Load
        event.

        Cheers,
        Wim Hollebrandse
        --
        Wimdows Components
        ..NET components - professional, robust and affordable.
        Zealand IT Ltd is a UK based IT consultancy and software development company that specialises in bespoke Microsoft .NET solutions including ASP.NET web applications and advanced SOA architectures for public and private sector clients. Please contact us for a free quote.

        --

        "Patrick De Ridder" <ngmail@freeler .nl> wrote in message
        news:a3okjvsv6u sb49c691ck3vs1r 1kl4ml5gk@4ax.c om...[color=blue]
        > I have a form with a number of text boxes. When I start the program I
        > want the cursor to be in one particular text box. I have tried
        > textbox4.Focus( ); in the constructor, but that doesn't do the trick.
        > How should it be done?
        > Many thanks,
        > --
        > Patrick De Ridder
        > ngmail@freeler. nl[/color]


        Comment

        • Patrick De Ridder

          #5
          Re: Focus


          Wim Hollebrandse <wimATwimdows.c om> wrote in message
          news:eC1IOPeYDH A.384@TK2MSFTNG P12.phx.gbl...[color=blue]
          > Alternatively, you can call the .Focus() method from within the Form_Load
          > event.[/color]
          I tried that and it didn't work!
          --
          Patrick


          Comment

          • Patrick De Ridder

            #6
            Re: Focus

            Wim Hollebrandse <wimATwimdows.c om> wrote in message
            news:#mMY9HfYDH A.2592@TK2MSFTN GP09.phx.gbl...[color=blue]
            > Wow - that's very unexpected behavior indeed.
            >
            > I did have a play around, and found a solution. You can set the
            > ActiveControl property of the Form object.
            >
            > For instance (assuming this is the current Form reference):
            >
            > this.ActiveCont rol = this.textBox1;
            >[/color]
            I will try it. Many thanks.
            --
            Patrick.


            Comment

            • 100

              #7
              Re: Focus

              Hi Patrick,
              The following is a quote from the MSDN about Control's TabStop property

              When the user presses the TAB key, the input focus is set to the next
              control in the tab order. Controls with the TabStop property value of false
              are not included in the collection of controls in the tab order. The tab
              order can be manipulated by setting the control's TabIndex property value.

              HTH
              B\rgds
              100


              "Patrick De Ridder" <ngmail@freeler .nl> wrote in message
              news:1060810730 .321946@evisp-news-01.ops.asmr-01.energis-idc.net...[color=blue]
              > 100 <100@100.com> wrote in message
              > news:#weULebYDH A.1916@TK2MSFTN GP12.phx.gbl...[color=green]
              > > Hi Patrik
              > > Try to set Textboxes' TabIndex properties properly. The text box with[/color][/color]
              tab[color=blue][color=green]
              > > index 0 should have the focus when you start the form. Make sure TabStop[/color]
              > is[color=green]
              > > set to true for all text boxes[/color]
              >
              > Thanks! I will do that.
              > Btw what does TabStop do?
              > --
              > Patrick
              >
              >[/color]


              Comment

              Working...