Link to home
Start Free TrialLog in
Avatar of jtrapat1
jtrapat1

asked on

Highlight Text With Textbox Control

I'm using VB6 against an SQL Server database.
I have a small routine which, if a user enters an invalid value, checks for a valid numeric number,resets the textbox to zero, and sets the focus to this field.
I'd like to highlight this section of text for the user, too.
Is there a way to do this with a normal textbox control or do I have to use a richtextbox control?
-------------------------------------------
Here's my routine in the LostFocus() event:
--------------------------------------------
If Not IsNumeric(txtAdjFundingAmt) Then
        MsgBox "Please Enter A Numeric Value", , "Adjusted Funding Amount"
        txtAdjFundingAmt.SetFocus
        txtAdjFundingAmt.Text = 0
    Else
        txtAdjFundingAmt = Format$(txtAdjFundingAmt, "###,###,###,##0")
    End If
-----------------------------------------------
I tried the richtextbox but it didn't like my error-checking routine and didn't allow the user to exit the textfield after an incorrect entry.

Thanks in advance.
John
ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial