Highlight Textbox Text
-
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
-
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
TextBox1.SelectAll()
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
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
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 )
-
TextBox1.SelectAll()
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Don'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 )
-
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 )
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
-
TextBox1.SelectAll()
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Thanks 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