Problem with t.SelectAll()
I am trying to write a sub that would select (highlight) the default values of my text boxes as they are entered.
Here is the code. For some reason the default value is not being highlighted when I mouse into a textbox. It does, however do so when I tab into it but I think it does that by default. What is wrong with my code or technique?
VB Code:
Private Sub txtOvtAc1_Enter(ByVal sender As Object, ByVal e _
As System.EventArgs) Handles txtOvtAc1.Enter, _
txtOvtAc2.Enter, txtOvtAc3.Enter, txtOvtAc4.Enter, _
txtOvtAf2.Enter, txtOvtBrh.Enter, txtOvtCar.Enter, _
txtOvtCpt.Enter, txtOvtFin.Enter, txtOvtLab.Enter, _
txtOvtLat.Enter, txtOvtPla.Enter, txtOvtSflr.Enter, _
txtOvtSpy.Enter, txtOvtTil.Enter, txtRegAc1.Enter, _
txtRegAc2.Enter, txtRegAc3.Enter, txtRegAc4.Enter, _
txtRegAf2.Enter, txtRegBrh.Enter, txtRegCar.Enter, _
txtRegCpt.Enter, txtRegFin.Enter, txtRegLab.Enter, _
txtRegLat.Enter, txtRegPla.Enter, txtRegSflr.Enter, _
txtRegSpy.Enter, txtRegTil.Enter
Dim t As TextBox
t = sender
t.SelectAll()
t.BackColor = Lavender
End Sub
By the way the backcor is being changed as expected.