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. How to always keep focus on a textbox?

How to always keep focus on a textbox?

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
4 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.
  • X Offline
    X Offline
    xbiplav
    wrote on last edited by
    #1

    I have a windows form which has several controls like buttons, listviews, labels and a textbox. Is there any generic way to always keep focus on that textbox?

    C 1 Reply Last reply
    0
    • X xbiplav

      I have a windows form which has several controls like buttons, listviews, labels and a textbox. Is there any generic way to always keep focus on that textbox?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Wow - let's see. You have buttons and listviews, and you never want any of them to get the focus ? how would that work ? I guess you could catch keypresses and always respond by focusing on the textbox.

      Christian Graus Driven to the arms of OSX by Vista.

      X 1 Reply Last reply
      0
      • C Christian Graus

        Wow - let's see. You have buttons and listviews, and you never want any of them to get the focus ? how would that work ? I guess you could catch keypresses and always respond by focusing on the textbox.

        Christian Graus Driven to the arms of OSX by Vista.

        X Offline
        X Offline
        xbiplav
        wrote on last edited by
        #3

        What my point is here. As soon as other control's work is done, then the textbox should be focus. I dont want to put textbox1.focus in every control's lostfocus event. I hope you understand me. Thanks!

        C 1 Reply Last reply
        0
        • X xbiplav

          What my point is here. As soon as other control's work is done, then the textbox should be focus. I dont want to put textbox1.focus in every control's lostfocus event. I hope you understand me. Thanks!

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          xbiplav wrote:

          As soon as other control's work is done, then the textbox should be focus.

          Then set is back to being focused. Control.Focus() method[^]

          * Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay


          Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

          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