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. Highlight Textbox Text

Highlight Textbox Text

Scheduled Pinned Locked Moved Visual Basic
com
6 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.
  • D Offline
    D Offline
    Duane in Japan
    wrote on last edited by
    #1

    If a mistake is made, a MsgBox pops up and prompts the user to insert a number instead of text. The cursor is then waiting at the end of the string and I have to backspace, then re-enter the number. I would like to already have the string completely highlighted for instant replacement without backspacing please. Thanks in advance, Duane in Japan If TextBox5.Text.Length = 0 Then 'http://msdn2.microsoft.com/en-us/library/139z2azd.aspx, MsgBox MsgBox("A 'B1' value is required.", MsgBoxStyle.Exclamation) e.Cancel = True ElseIf Not IsNumeric(TextBox5.Text) Then MsgBox("This 'B1' value is not numeric.", MsgBoxStyle.Exclamation) e.Cancel = True

    D C 2 Replies Last reply
    0
    • D Duane in Japan

      If a mistake is made, a MsgBox pops up and prompts the user to insert a number instead of text. The cursor is then waiting at the end of the string and I have to backspace, then re-enter the number. I would like to already have the string completely highlighted for instant replacement without backspacing please. Thanks in advance, Duane in Japan If TextBox5.Text.Length = 0 Then 'http://msdn2.microsoft.com/en-us/library/139z2azd.aspx, MsgBox MsgBox("A 'B1' value is required.", MsgBoxStyle.Exclamation) e.Cancel = True ElseIf Not IsNumeric(TextBox5.Text) Then MsgBox("This 'B1' value is not numeric.", MsgBoxStyle.Exclamation) e.Cancel = True

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      TextBox1.SelectAll()

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      C D 2 Replies Last reply
      0
      • D Duane in Japan

        If a mistake is made, a MsgBox pops up and prompts the user to insert a number instead of text. The cursor is then waiting at the end of the string and I have to backspace, then re-enter the number. I would like to already have the string completely highlighted for instant replacement without backspacing please. Thanks in advance, Duane in Japan If TextBox5.Text.Length = 0 Then 'http://msdn2.microsoft.com/en-us/library/139z2azd.aspx, MsgBox MsgBox("A 'B1' value is required.", MsgBoxStyle.Exclamation) e.Cancel = True ElseIf Not IsNumeric(TextBox5.Text) Then MsgBox("This 'B1' value is not numeric.", MsgBoxStyle.Exclamation) e.Cancel = True

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

        Is this VB6 or VB.NET ?

        Duane in Japan wrote:

        TextBox5

        Why no proper variable names ? You can set the selectionstart and selectionlength properties, from memory on a textbox. There are certainly properties on the control to select what text is highlighted.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        D 1 Reply Last reply
        0
        • D Dave Kreskowiak

          TextBox1.SelectAll()

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

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

          Don't you mean TextBox5.SelectAll() :P I didn't realise that was there, I just knew there were selection properties.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          1 Reply Last reply
          0
          • C Christian Graus

            Is this VB6 or VB.NET ?

            Duane in Japan wrote:

            TextBox5

            Why no proper variable names ? You can set the selectionstart and selectionlength properties, from memory on a textbox. There are certainly properties on the control to select what text is highlighted.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            D Offline
            D Offline
            Duane in Japan
            wrote on last edited by
            #5

            I am still quite new and this project is a second attempt, the first time was five years ago, this time it is working much better with VB Studio, thanks for the help, I will give it a try. When this project is completely debugged I will then give proper names and re-debug. Training in progress..... Duane in Japan

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              TextBox1.SelectAll()

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              D Offline
              D Offline
              Duane in Japan
              wrote on last edited by
              #6

              Thanks Dave et al, Just had to figure out where to put it, Right under the Dim statements prior to the error handler MsgBox events. Now just paste it in my project 9 more times. Duane in Japan

              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