Results 1 to 16 of 16

Thread: Getting Spicific text From Textbox[RESOLVED]

  1. #1

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    Resolved 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
    Last edited by messup000; Aug 18th, 2005 at 03:46 PM.

  2. #2

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    Re: Getting Spicific text From Textbox

    Please Help Me! Thanks a bunch

  3. #3
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    Re: Getting Spicific text From Textbox

    This might do it for you.

    VB Code:
    1. 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
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  4. #4

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    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.

  5. #5
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    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
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.   Dim t$
    5.   Dim sstart As Integer, sstop As Integer
    6.   t = "<embed width=""550"" height=""400"" src=""http://agflashfarm.com/D78AQSAKQLQWI9/2019.swf quality"
    7.   sstart = InStr(t, "src=") + 5
    8.   sstop = InStr(t, " qual")
    9.   MsgBox Mid$(t, sstart, sstop - sstart)
    10. End Sub

  7. #7

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    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

  8. #8

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    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
    Last edited by messup000; Aug 18th, 2005 at 03:44 PM.

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Getting Spicific text From Textbox

    Just substitute your text1.text textbox where I have the variable "t" and it should work.

  10. #10
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  11. #11

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    Resolved 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

  12. #12
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  13. #13

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    Re: Getting Spicific text From Textbox

    srry uploaded the wrong frm
    Attached Files Attached Files

  14. #14
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    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.
    Attached Files Attached Files
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  15. #15

    Thread Starter
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    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

  16. #16
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Getting Spicific text From Textbox[RESOLVED]

    No problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width