Spider Help? (new problem)

Discussion in 'Code Snippets and Tutorials' started by Anonymous, Feb 27, 2007.

  1. Anonymous

    Anonymous Guest

    EDIT: New Problem!!!!
    How can I make VB6 randomly pick a URL from a list? I have the list allready loaded into vb6, but I have NO idea how to make it pick a random one.

    eg.
    Code (Text):
    1. Private Sub Timer2_Timer()
    2.  
    3. Dim answerB As Integer
    4. Dim numeventsB As Integer
    5.  
    6. numeventsB = lblNumberB
    7.  
    8.  
    9. If Not Len(txtURL.Text) <= 0 Then
    10. strHTML = Form2.gluraks.GetWrapper(AHAHAHHAHAHAHA)
    11. End If
    12. If InStr(1, strHTML, "Somthing Has") Then
    13. txtLog.AddItem "Random Event Gotten!", 0
    14.  
    15. answerB = numeventsB + 1
    16. lblNumberB.Caption = answer
    17.  
    18. End Sub
    19.  
    *AHAHAHAHAHAHAH = A random URL from my list.

    Thanks,
    Oddworth





    I'm blonde. How do I use the Tabs control in vb6? I can make the tabs, but I have NO idea how ot use them.

    thanks,
    Oddworth
     
  2. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    to use tabs you insert it into your program. You then select a tab and put whatever you want on it. Then click on the other tab and put what you want on it. To add tabs go to the property pages of the tab control. Pm me if you need help and if i helped you+rep is apprciated
    ~thanks
     
  3. Anonymous

    Anonymous Guest

    you mean, all yo uhave to do Is drag things onto them? :eek:

    THNAKS! +rep

    Post #2:

    friendly bump becaus eof new problem.

    EDIT: Sorry for double post :oops:

    Oddworth - You don't bump a post with consecutive posts... not to mention... we don't bump posts here. - Marlene
     
  4. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    OK i just am taking this off the top of my head.
    Code (Text):
    1. Dim inturl as integer
    2. inturl = rand * 100 'or how many urls in your list
    3. If inturl = 1 then
    4. httpwrapper.getwrpaer(http://www.neopets .com/explore)
    5. If inturl = 2
    6. httpwrapper.getwrpaaer(http://www.neopets .com/adopt)
    If you are doing it from a list I will ad that later Rand MAY be misspelled
     
  5. Anonymous

    Anonymous Guest

    my friend helped me with this, but I need a function for "CreateRandNumber"

    Code (Text):
    1. Private Sub Timer2_Timer()
    2. Dim i As Integer
    3. Dim numeventsB As Integer
    4.  
    5. numeventsB = lblNumberB
    6.  
    7. If Not Len(txtURL.Text) <= 0 Then
    8.    i = CreateRandNumber(0, URLlist.ListCount)
    9.    strList = URLlist.List(i)
    10.    strHTML = Form2.gluraks.GetWrapper(strList)
    11. End If
    12.  
    13.     If InStr(1, strHTML, "Neopets") Then
    14.     txtLog.AddItem "TEST (Success)", 0
    15.     numeventsB = numeventsB + 1
    16.     lblNumberB.Caption = numeventsB
    17.     End If
    18.  
    19. End Sub
    Thanks,
    Oddworth
     
  6. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    Here is it:
    Code (Text):
    1. Public Function CreateRandNumber(ByVal Low As Long, ByVal High As Long) As Long
    2.     Randomize
    3.     CreateRandNumber = Int(Math.Rnd() * ((High + 1) - Low) + Low)
    4. End Function
    It should work ;)
     
  7. Anonymous

    Anonymous Guest

    thanks ricky! It works! +rep!
     
  8. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    Post it, I'll try to help you ;)