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. Selection Control??

Selection Control??

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
3 Posts 2 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.
  • I Offline
    I Offline
    icowa
    wrote on last edited by
    #1

    Ok, let's say I have a textbox called 'txtbox1'. I limit its maxlength to 6. I put in its text content to be '123456' Now, the thing is, when I run this form, the program will automatically hightlight selection all '123456'. Is it possible for me to add some code to control that selection? Example, instead of it highlight selecting all '123456' , can i put in a code to make it only highlight select '234' whenever I load the form? Or better yet, can I even disable this highlight selection?

    E 1 Reply Last reply
    0
    • I icowa

      Ok, let's say I have a textbox called 'txtbox1'. I limit its maxlength to 6. I put in its text content to be '123456' Now, the thing is, when I run this form, the program will automatically hightlight selection all '123456'. Is it possible for me to add some code to control that selection? Example, instead of it highlight selecting all '123456' , can i put in a code to make it only highlight select '234' whenever I load the form? Or better yet, can I even disable this highlight selection?

      E Offline
      E Offline
      Eduard Keilholz
      wrote on last edited by
      #2

      The textbox has 2 important properties to control text selection : SelectionStart SelectionLength Start indicates the start position of your selection Length indicates the length of the selection Automaticly when a textbox gets focused, the SelectionStart is set to 0 en the selection length depends on the textlength. Handle the OnGotFocus event and set the SelectionStart en SelectionLength properties to your desired values and your problem should be solved... I love it when a plan comes together

      I 1 Reply Last reply
      0
      • E Eduard Keilholz

        The textbox has 2 important properties to control text selection : SelectionStart SelectionLength Start indicates the start position of your selection Length indicates the length of the selection Automaticly when a textbox gets focused, the SelectionStart is set to 0 en the selection length depends on the textlength. Handle the OnGotFocus event and set the SelectionStart en SelectionLength properties to your desired values and your problem should be solved... I love it when a plan comes together

        I Offline
        I Offline
        icowa
        wrote on last edited by
        #3

        Man, I have been pondering this part for a 2 hours and the solution is actually such a simple step... Hehehe..Anyway, it works. So thanz a lot, Eduard.

        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