Need VB help :(

Discussion in 'VB' started by xtruk, Jun 11, 2012.

  1. xtruk

    xtruk Gold Member Gold Subscriber
    0/47

    Just playing about in VB and trying to make it so when you press a button it loads 1 pages then waits 1 second and then loads the next website within the WebBrowser


    Code:
    	Private Sub TaterDrop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TaterDrop.Click
    		WebBrowser1.Navigate("Website1")
    	  
    	   ' Wait 1 second then open next page
    
    		WebBrowser1.Navigate("Website2")
    	End Sub
    
    what ever I try to make it wait certain amount of time in between the 2 websites it just loads Website2

    any help would be appreciated :)
     
  2. Je

    Jet2020 HeXtra Creator XPG Developer
    0/47

    show me your hole source
     
  3. xtruk

    xtruk Gold Member Gold Subscriber
    0/47

    that is basically it really just a simple web browser with 1 button

    Code:
    Public Class Form1
    	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    	End Sub
    	Private Sub TaterDrop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TaterDrop.Click
    		WebBrowser1.Navigate("Website1")
    		'Wait 1 second then open next page'
    		WebBrowser1.Navigate("Website2")
    	End Sub
    	Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    	End Sub
    End Class
    
     
  4. Je

    Jet2020 HeXtra Creator XPG Developer
    0/47

    explain what you want the button to do because its not clear at all what you want to do
     
  5. Homura

    Homura Creator of Avalon XPG Developer Lifetime Gold
    85/94

    you need a timer. if you want it to wait.
     
  6. xtruk

    xtruk Gold Member Gold Subscriber
    0/47

    basically when you press the button it will load website1 then once that has loaded i would like it to then load website2
     
  7. Homura

    Homura Creator of Avalon XPG Developer Lifetime Gold
    85/94

    like I said use a timer. look up some tuts on how to use timers. it is easier that way ;)
     
  8. xtruk

    xtruk Gold Member Gold Subscriber
    0/47

    Ok thanks I will have a read up I haven't touched VB since my college days 5 years ago everything is a blur aha
     
  9. Je

    Jet2020 HeXtra Creator XPG Developer
    0/47

    Add a timer and name it "TmrDelay"

    Then add this where you got wait 1 secound

    1000 = 1 second


    Code:
    dim b as integer
    sub foo()
    tmrDelay.Interval = 1000
    tmrdelay.enabled=true
    i=-1
    tmrDelay.Start()
    while(i<0)
    wend
    end sub
    
    sub tmrDelay_tick()
    i=1
    end sub
     
  10. Homura

    Homura Creator of Avalon XPG Developer Lifetime Gold
    85/94

    Good job too lazy to write that. it would have been better if he looked up how to do it himself so in the future he can do it by himself. but good job ;)

    No prob ;) it is easy to do these kinds of things. just takes a little practice/research. make sure to look for tutorials next time. they will explain everything in detail for you so can understand how to do it.
     
  11. Je

    Jet2020 HeXtra Creator XPG Developer
    0/47

    For newbies/trying to refresh

    Google is your best friend ;)
     
  12. xtruk

    xtruk Gold Member Gold Subscriber
    0/47

    Thanks for the help. I feel stupid now asking that was easy to do really just me being dumb after 5 years of not even looking at VB ahaha
     
  13. Je

    Jet2020 HeXtra Creator XPG Developer
    0/47

    Well you have got it now


    Did it work? And good luck trying to do it again
     
  14. KillerVidz

    KillerVidz Rocky BANNED
    0/47

    lol u Do Relise This Bi
    t 'Wait 1 second then open next page'
    Dosent Do Any Thing lol
     
  15. xtruk

    xtruk Gold Member Gold Subscriber
    0/47

    yeah I know lol, I put the comment there as I tend to get side tracked then forget what I was trying to do but its all sorted and working now
     

Share This Page