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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox Modified Not Changed If Only One Character Is Changed

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
The following code recognizes the text box was Modified when I change the entire value, but if I use the mouse to hi-lite one or more characters and change it, then modified is still false. Is that because I have it in the validated event?
Code:
  Private Sub txtDecimal_Validated(ByVal sender As Object, ByVal e As EventArgs) _
    Handles txtUnitAmount.Validated, txtUnitPrincipal.Validated, txtUnitInterest.Validated
    Dim txtbox As TextBox
    txtbox = DirectCast(sender, TextBox)

    If txtbox.Modified Then
      ReCalcLine()
    End If
  End Sub

Auguy
Sylvania/Toledo Ohio
 
Try using the TextBox.TextChanged event to capture any changes in the Text property of a TextBox.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Doesn't that fire with every character that is input? I guess I could move the code to the Leave event. Still seems strange that modified doesn't get set to "Modified" when you change just one character.

Auguy
Sylvania/Toledo Ohio
 
TextChanged event
Auguy said:
Doesn't that fire with every character that is input?

Best way to know is to give it a try and see....[pc2]


---- Andy

There is a great need for a sarcasm font.
 
Yes it does!

Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top