|
-
Aug 19th, 2008, 07:39 PM
#1
Thread Starter
Addicted Member
[2008] display varying picture with substring
I'm trying to display a picture inside of a picture box with a url using substring.
While testing it out i just made a text box that displays the source of the webbrowser page with the picture.
The problem is the image url is inside quotations.So, it confuses vb since i have it in like this...
Dim str As String
str = (TextBox1.Text.ToString)
PictureBox1.ImageLocation = (str.Trim.Substring(str.Trim.IndexOf("src="), (str.Trim.Length - str.Trim.IndexOf("src="))))
PictureBox1.ImageLocation = (str.Trim.Substring(0, str.Trim.IndexOf(" alt=")))
In the source of the HTML it has the image location in quotations so when it's going to the image location it's trying to show this location..
"http://itemdb-rs.runescape.com/2365_obj_big.gif?id=2861"
So, is there a way to get it to ignore the quotation marks? And go to what's inside of them?
-
Aug 19th, 2008, 07:54 PM
#2
Re: [2008] display varying picture with substring
You can use Trim to remove leading and trailing characters. Without parameters it removes whitespace but you can specify characters to trim.
That said, you'd be better off using a Regex to get the URL without all that rigmarole. There will undoubtedly be examples on the forum already so you should search.
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
|