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. C#
  4. Set cursor in textbox

Set cursor in textbox

Scheduled Pinned Locked Moved C#
question
3 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.
  • W Offline
    W Offline
    Wheels012
    wrote on last edited by
    #1

    Good morning all. I am attempting to set the cursor in a textbox for a user where they can continue to type. In this case I am adding http:// on the textbox enter event. I would like the curson to 'wait' at the end of the / instead of the https:// being highlighted. If the user doesn't click after the / they will type over the http://. I have seen some complicated code on the web to simulate a mouse click, but I would prefer a more simpler method. Any suggestions? Thank you, WHEELS

    F 1 Reply Last reply
    0
    • W Wheels012

      Good morning all. I am attempting to set the cursor in a textbox for a user where they can continue to type. In this case I am adding http:// on the textbox enter event. I would like the curson to 'wait' at the end of the / instead of the https:// being highlighted. If the user doesn't click after the / they will type over the http://. I have seen some complicated code on the web to simulate a mouse click, but I would prefer a more simpler method. Any suggestions? Thank you, WHEELS

      F Offline
      F Offline
      freakyit
      wrote on last edited by
      #2

      hi, for you continue typing use "textBox1.SelectionStart = textBox1.Text.Length" if the Text of the textbox is only http:// or https:// if something is written behind the last / you need to search the position of the last / .... You can set the cursor of the whole textbox to a wait cursor but only at a position you need to programm it your self, that would be a little tricky.. greetz :)

      W 1 Reply Last reply
      0
      • F freakyit

        hi, for you continue typing use "textBox1.SelectionStart = textBox1.Text.Length" if the Text of the textbox is only http:// or https:// if something is written behind the last / you need to search the position of the last / .... You can set the cursor of the whole textbox to a wait cursor but only at a position you need to programm it your self, that would be a little tricky.. greetz :)

        W Offline
        W Offline
        Wheels012
        wrote on last edited by
        #3

        Hi rootjumper. The textBox1.SelectionStart = textBox1.Text.Length is exactly what I was looking for. Thank you, WHEELS

        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