|
-
Jun 26th, 2000, 06:03 PM
#1
Thread Starter
Addicted Member
I have a text box and i need to know how to select the highlight text in the text box, i am not sure how to do this and would like some help if you could give me any example code i would like to thank you ver much...
Rohan
-
Jun 26th, 2000, 06:08 PM
#2
Fanatic Member
not sure what you mean.
To highlight text do
Code:
'highlights all of the text in the text box
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
to get the highlighted text into a variable use.
Code:
strText = Mid$(Text1.Text, Text1.SelStart, Text1.SelLength)
Iain, thats with an i by the way!
-
Jun 26th, 2000, 06:18 PM
#3
Thread Starter
Addicted Member
Cannot get that to work
The method that you just posted didnt seem to work here is the code that i am using......
Private Sub lstCourses_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
txtsearch.Text = lstCourses.Text
txtsearch.SelStart = 0
txtsearch.SelLength = Len(txtsearch.Text)
End Sub
-
Jun 26th, 2000, 06:21 PM
#4
transcendental analytic
Iain, you can use seltext property instead to get the selected text:
Code:
strText = text1.seltext
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 26th, 2000, 06:24 PM
#5
Fanatic Member
Doh, forgot all about that Kedaman. Silly me.
Any way, for a text box to be highlighted it must have the focus. So at the end of that sub do.
"Text1.SetFocus"
Iain, thats with an i by the way!
-
Jun 26th, 2000, 06:26 PM
#6
Thread Starter
Addicted Member
Working...Thank you guys
It works .... I didnt set the focus....thank you
-
Jun 26th, 2000, 06:27 PM
#7
Fanatic Member
Or set the textboxes "HideSelection" property to false. This will cause the text box to show what is highlighted even when it does not have the focus.
Iain, thats with an i by the way!
-
Jun 26th, 2000, 06:30 PM
#8
Thread Starter
Addicted Member
Question.....
That was my next question......thank you guys
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
|