Getting Spicific text From Textbox[RESOLVED]
I have a textbox that is gets filled with a webpages html page source. What I need is a way to get just this part of the Html (the src will be always different):
<embed width="550" height="400" src="http://agflashfarm.com/D78AQSAKQLQWI9/2019.swf" quality=high NAME=FlashContent AllowScriptAccess=never TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed>
and then be able to extract the URL from that so that im just left with the url which would be in this case http://agflashfarm.com/D78AQSAKQLQWI9/2019.swf. now i could just replace the information around the url but what I need help on is how to take just this part of the code out of the webpages html page source
Re: Getting Spicific text From Textbox
Please Help Me! Thanks a bunch
Re: Getting Spicific text From Textbox
This might do it for you.
VB Code:
strResult = Mid$(Text1.Text, InStr(1, Text1.Text, "src=", vbTextCompare) + 5, InStr(1, Text1.Text, ".swf", vbTextCompare) - InStr(1, Text1.Text, "src=", vbTextCompare) - 1)
HTH
Re: Getting Spicific text From Textbox
Nope no go Thx for the help tho. Im pretty new with the instr was just introduced to it not quite sure how to use it well yet. Again thx for the try.
Re: Getting Spicific text From Textbox
Can you tell me why that didn't work? cause it seems to be working on a little test app i wrote
Re: Getting Spicific text From Textbox
This will pull out the address, and show you how to use instr()
I replaced the " with "" to get it into a string.
VB Code:
Option Explicit
Private Sub Form_Load()
Dim t$
Dim sstart As Integer, sstop As Integer
t = "<embed width=""550"" height=""400"" src=""http://agflashfarm.com/D78AQSAKQLQWI9/2019.swf quality"
sstart = InStr(t, "src=") + 5
sstop = InStr(t, " qual")
MsgBox Mid$(t, sstart, sstop - sstart)
End Sub
Re: Getting Spicific text From Textbox
ok i made a example of it. It deletes almost everything. But theres still a good amount of code left. :( Ill upload the example in a sec
Re: Getting Spicific text From Textbox
Heres the code. The swf links at the end. But I still need to find out how to get rid of the begining part that i wont know what it exactly is. Go down uploaded wrong frm
Re: Getting Spicific text From Textbox
Just substitute your text1.text textbox where I have the variable "t" and it should work.
Re: Getting Spicific text From Textbox
Instr function takes two main parameters, the original string (text) and the string it is supposed to look for. If it returns zero (0), it means that the string you are looking for is not in the orignal string. If it returns a non zero value, that value is the starting position of the string you looked for.
So if you had "This is a test text." and you do:
MsgBox InStr ("This is a test text.", "Sample") you will get zero as Semple is not contained in "This is a test text."
if you do MsgBox InStr("This is a test text.", "is") you will get 6, which means that "is" starts on the 6th position.
Re: Getting Spicific text From Textbox
WOW thx a bunch dglienna that works great and that helps me understand instr alot better! THX
k now im starting to get this....
THX EVRY1 I finally got my problem resolved
Re: Getting Spicific text From Textbox
Dglienna's code works. And by the way, you need to upload all the project files. What you uploaded does not work.
1 Attachment(s)
Re: Getting Spicific text From Textbox
srry uploaded the wrong frm
1 Attachment(s)
Re: Getting Spicific text From Textbox[RESOLVED]
Ah i see what my problem was. I was assuming that the test you posted was all that you wanted to parse. I fixed my problem by starting the instr function at the "<embed" instead of at 1. I'm not sure if you need this anymore but i'll upload it for ya.
Re: Getting Spicific text From Textbox[RESOLVED]
Thanks a bunch for all the help baja yu, space monkey and dglienna i really apreciate it.
Messup000
Re: Getting Spicific text From Textbox[RESOLVED]