Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting text in a text box

Status
Not open for further replies.

amberlynn

Programmer
Dec 18, 2003
502
0
0
CA
Hello,

I'm using the following code to ensure the user is entering a numeric value:

Private Sub txtSeriesPercent1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSeriesPercent1.TextChanged
EcoUnitIsDirty = True
If IsNumeric(txtSeriesPercent1.Text) Then
checkPercentTotal()
Else
MessageBox.Show("Value " & txtSeriesPercent1.Text & " is not numeric!", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtSeriesPercent1.SelectAll()
End If

End Sub

I use the .selectAll line so that the textbox text is highlight for the user to correct it.
It doesn't work...
If I put a breakpoint in the sub, and step through it, it works, and the textbox text ends up highlighted, but if I don't have a breakpoint, the textbox doesn't end up highlighted...

Why is this??
TIA!
Amber
 
what you are doing should be working,
but you could try

Code:
txtSeriesPercent1.focus()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top