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. Visual Basic
  4. textbox.focus - won't listen

textbox.focus - won't listen

Scheduled Pinned Locked Moved Visual Basic
5 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.
  • N Offline
    N Offline
    nlarson11
    wrote on last edited by
    #1

    On a certain condition, I want the focus to start with a different control then the first one. No matter what I do it won't listen to the command textbox7.focus. In the form load I put the command. In form activate I put the command. Is there an alternative to have to create something like a timer to activate to set focus after the form is fully visible... Any tips would be appreciated... Nathan

    'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

    C W 2 Replies Last reply
    0
    • N nlarson11

      On a certain condition, I want the focus to start with a different control then the first one. No matter what I do it won't listen to the command textbox7.focus. In the form load I put the command. In form activate I put the command. Is there an alternative to have to create something like a timer to activate to set focus after the form is fully visible... Any tips would be appreciated... Nathan

      'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

      C Offline
      C Offline
      C1AllenS
      wrote on last edited by
      #2

      Hello Nathan, You can try setting the TabIndex property of the control. You can use this in Form_load event. TextBox1.TabIndex = 0 I hope this helps. Regards, Allen

      Allen Smith Software Engineer ComponentOne LLC www.componentone.com

      N 1 Reply Last reply
      0
      • C C1AllenS

        Hello Nathan, You can try setting the TabIndex property of the control. You can use this in Form_load event. TextBox1.TabIndex = 0 I hope this helps. Regards, Allen

        Allen Smith Software Engineer ComponentOne LLC www.componentone.com

        N Offline
        N Offline
        nlarson11
        wrote on last edited by
        #3

        if that control is the first or last textbox then that's ok solution. however by doing so wouldn't that screwup the tab order for the rest of the controls?

        'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

        N 1 Reply Last reply
        0
        • N nlarson11

          if that control is the first or last textbox then that's ok solution. however by doing so wouldn't that screwup the tab order for the rest of the controls?

          'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

          N Offline
          N Offline
          nlarson11
          wrote on last edited by
          #4

          incase anyone is curious you need to use the paint event and setup a static variable to only issue the focus command once...

          'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

          1 Reply Last reply
          0
          • N nlarson11

            On a certain condition, I want the focus to start with a different control then the first one. No matter what I do it won't listen to the command textbox7.focus. In the form load I put the command. In form activate I put the command. Is there an alternative to have to create something like a timer to activate to set focus after the form is fully visible... Any tips would be appreciated... Nathan

            'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

            W Offline
            W Offline
            Werries
            wrote on last edited by
            #5

            Hi there, Use the Select command. - txtTextBox.Select :)

            A programmer's life is good... or is it?? Ek dink nie so nie!

            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