-
SelStart And SelLength
hi all,
i have 20 txtboxes where a user has to input a correct answer to a question , if incorrect i want the text to be highlighted
i have used the code below but only 1 txtbox highlights even if more are incorrect.
If LCase(Text1) Like LCase("Fred") Then
lblScore.Caption = lblScore.Caption + 1
Else
lblScore.Caption = lblScore.Caption + 0
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
tink
-
dat is coz it will only show da highlight on da textbox dat 'as da focus.
Only one control can 'ave da focus at any one time, aye
Respect
-
That is becasue you only specified 1 textbox. If you have 20 boxes then you have to do that for each textbox, unless you take my earlier suggestion and make a control array. Then you can do it much easier.
-
ok, try dis experiment
Open up any app dat has lots of textboxes, any windoze app. now, what 'appens whun you highlight some text in one of da boxes, ten move da focus elsewhere? would you belive, but da highlight disapears
it is 'ow windoze works and der is nuffin yous can do abou' it
respeck
-
You have actually select the text in more than 1 textbox. You'll have to first set the property "HideSelection(or similar)" to false for all the textboxes, then you can either select the text in all the textboxes manually or you can have an array of 20 textbox, and then you just to select the text in a loop.