|
-
Nov 4th, 2001, 03:06 PM
#1
Thread Starter
Lively Member
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
-
Nov 4th, 2001, 03:08 PM
#2
Lively Member
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
-
Nov 4th, 2001, 03:19 PM
#3
PowerPoster
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.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Nov 4th, 2001, 03:22 PM
#4
Lively Member
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
-
Nov 4th, 2001, 03:38 PM
#5
PowerPoster
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|