|
-
December 16th, 1999, 08:31 PM
#1
String in text related
I have a line "Select 45 //Flat"
I used VB to find string "Select"...now how do I tell VB to select whole line which is "Select 45 //Flat" ...I can't use find "Select 45 //Flat" because 45 can be any number, so I need to select whole line (Select 45 //Flat) in textbox where that "Select" was found...how?
Thank You
-
December 17th, 1999, 04:02 AM
#2
Re: String in text related
If you've figured out how to find the 'Select' position in the text box, then getting the length of the line is quite straight forward :
private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(byval hwnd as Long, byval wMsg as Long, byval wParam as Long, _
lParam as Any) as Long
private Const EM_LINELENGTH = &HC1
Say, for instance, that a variable 'lStart' has been set with the start position of the 'Select' text :
Dim lLineLen as Long
Dim sSelectedText as string
'
lLineLen = SendMessage(Text1.hwnd, EM_LINELENGTH, lStart, 0&)
'
sSelectedText = mid$(Text1.Text, lStart, lLineLen - lStart)
- that should be enough to get you on the right track - you'll obviously need to change the 'text1.' to your textbox name.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
December 17th, 1999, 04:17 AM
#3
Re: String in text related
Lothar was once suggesting Using Scripting Runtime (if you have IE 40 or later, SCRRun.dll ? ) for this kind of Parsing/Data validatoin etc.
You can use similar features of that model for doing this kind of 'advanced search'ing too. It will come under 'parsing logic' actually. May be you can contact him!..
RK
-
December 17th, 1999, 08:34 PM
#4
Re: String in text related
OK, it does work and it does return me the selected string but why does it return string as number, I need it as value.....What should I fix....
Thank You
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
|