By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Find a changing value in a text box with the help of non changing data

P: 2
Dear friends,

I have written a little program to read the source of a web page into a Rich Text Box. Now I want to find a specific integer value in that text box and take it into a variable. That integer value in the web page changes from time to time, but the text before that integer won't change. How can I get the integer into a variable? please help me...

Eg: <body> .... Customer base- 2200..... </body>

here the non changing string is "Customer base-" and the changing integer is 2200
Sep 16 '07 #1
Share this Question
Share on Google+
2 Replies


VBPhilly
P: 95
Dear friends,

I have written a little program to read the source of a web page into a Rich Text Box. Now I want to find a specific integer value in that text box and take it into a variable. That integer value in the web page changes from time to time, but the text before that integer won't change. How can I get the integer into a variable? please help me...

Eg: <body> .... Customer base- 2200..... </body>

here the non changing string is "Customer base-" and the changing integer is 2200
parse up to the location of 'Customer base-'

take everything afterwards.

a trick would be to split the string: first half having data up to customer base-, second half having remaining data.

Expand|Select|Wrap|Line Numbers
  1.  
  2. dim strSplit 
  3. strSplit = Split(txtbox.text, 'customer base-') 
  4. 'strSplit(0) ' should be <body> .. customer base-
  5. 'strSplit(1) 'should be 2200..</body>
  6.  
looks like there's a space after your numeric. in that case, use mid with the results of instr to find this white space:

Expand|Select|Wrap|Line Numbers
  1.  
  2. dim strResult as string 
  3.  
  4. strResult = strSplit(1)
  5. strResult = mid(strResult, 1, Instr(1, strResult, ' ') - 1) 
  6.  
  7.  
Sep 16 '07 #2

Expert 5K+
P: 8,434
Keep in mind, the RichTextBox control has methods built in to do this sort of selection. I don't recall what they are right now, but should be able to look them up at lunch time.
Sep 17 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.