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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Setting Focus inside a text box

Setting Focus inside a text box

Scheduled Pinned Locked Moved Visual Basic
question
2 Posts 2 Posters 1 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
    New_Coder
    wrote on last edited by
    #1

    How can I set the focus of to the end of the text in my text box. Clicking on a button I am populating a text box with code ie ShowThisText = "This is my Text" I then set the focus to the text box ie ShowThisText.setfocus The cursor by default is at the left of the "This is my Text" I want to be able to add on to the sentence without having to move to the right to start typing Any Ideas?

    L 1 Reply Last reply
    0
    • N New_Coder

      How can I set the focus of to the end of the text in my text box. Clicking on a button I am populating a text box with code ie ShowThisText = "This is my Text" I then set the focus to the text box ie ShowThisText.setfocus The cursor by default is at the left of the "This is my Text" I want to be able to add on to the sentence without having to move to the right to start typing Any Ideas?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      The code

      TextBox1.SelectionStart = TextBox1.TextLength
      TextBox1.Focus()

      will put the cursor at the end of the text in TextBox1.

      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