1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need help with my vb.net project

Discussion in 'Visual Basic .NET' started by specopkirbs, Mar 23, 2010.

  1. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    im creating a very basic vb.net app and would like some advice
    im putting myself through a steep learning curve.
    basically i have the app so that it opens a webpage in a browser window
    but what i would like it to do is once the first page has loaded, to open a different webpage in the same browser window
    like i said its very very basic
    can anyone advise me on the steps i need to make next here is the code so far
    Code:
    
    Public Class Form1
        Dim automate As Boolean
        Dim yourpage As String
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            yourpage = TextBox1.Text
            automate = True
            WebBrowser1.Navigate("http://www.google.com")
    
        End Sub
    
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            If automate = True Then automate = False Else Exit Sub
        End Sub
    End Class
    
    so what i would like it to do is open a different page for example yahoo once the first page has finished loading, is this possible?
    my coding skills are very very basic like i said im putting myself through a steep learning curve
    what i was thinking is that it would have to go through a loop then once it returns to the first page it stops and gives a message box saying complete
    any help would be appretiated
    cheers
     
  2. crashed

    crashed Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 13, 2008
    Messages:
    958
    Likes Received:
    1,198
    Occupation:
    Guru-slayer
    Location:
    Behind the VPN...
    Home Page:
    Use a timer, and set the timer to check if WebBrowser1.State is ready/loaded, and if it then just use WebBrowser1.Navigate to move to the next page.
     
    • Thanks Thanks x 1
  3. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    the yourpage variable is irrelivent at this time so ignore that for now
     
  4. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    thanks going to look into that now...dont want to be spoon fed so im researching each bit, thanks for the advice :)
     
  5. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    ok so im progressing ... er .... slowly with my vb.net learning
    my next issue is this
    how do i call a line from a text file so if you look at my code above
    how do i call a text file with a list of websites in it and then visit each site from a different time in turn?
    im actually willing to pay for some training on this as im picking it up pretty fast but im spending all day searching g for the answers
     
  6. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    ok managed to sort out my initial questions and have created a useable program that i will share here free shortly
    my next question for my more advanced version is how to add licencing, i know there are some comercial options available for vb.net but they are quite expensive considering im only going to be charging a few dollars for the program
    any suggestions on cracked licencing programs for vb.net or budget or ideally free
    preferably i would like the licencing to be based upon the users mac address or hardware signitures any suggestions would be most welcomed
     
  7. Classytallpaul

    Classytallpaul Newbie

    Joined:
    Oct 6, 2009
    Messages:
    20
    Likes Received:
    27
    Occupation:
    Owner of Winclub.ca - Roulette Coaching
    Location:
    Toronto, Canada
    Im at the same level with my programs, trying to figure out a (free) way to license them, also a good way to obfuscate my code would be good as mo fos have been decompiling my bots. :/

    here are a couple of articles that may help you, both have some source code to play with.

     
    • Thanks Thanks x 1
  8. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    thanks dude appretiated hitm me up if you want to chat on IM, im going to launch a site to sell my tools shortly if your interested in selling yours also.
     
  9. jay2success

    jay2success Registered Member

    Joined:
    Dec 13, 2008
    Messages:
    91
    Likes Received:
    40
    You can use activelock for VB.NET.
    It's free open source library and i believes many programmers use it also because i have seen it.
    Hope this helps.
    Code:
    www.activelock.com
     
  10. crashed

    crashed Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 13, 2008
    Messages:
    958
    Likes Received:
    1,198
    Occupation:
    Guru-slayer
    Location:
    Behind the VPN...
    Home Page:
    Do yourself a favour, teach yourself about error handing, and how to code to manage error's before you start looking at licensing.

    I've got exactly the same program that you have code running through my personal list of URL's atm :D
     
  11. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    thanks dude im currently studying errors and debugging, oh the joy
     
  12. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    thanks mate been looking at that looks interesting
     
  13. arbydee2

    arbydee2 Regular Member

    Joined:
    Mar 20, 2010
    Messages:
    413
    Likes Received:
    223
    Location:
    127.0.0.1
    Home Page:
    Study what subs, functions and return values are first. Study how to read msdn and not copying and pasting codes. After that look into httpwebrequest classes.
     
  14. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    any reccomended resources i should take a look at? preferably online and free though obviously im willing to pay a few bucks to get what i need.
     
  15. Dimension

    Dimension Newbie

    Joined:
    Jul 11, 2009
    Messages:
    9
    Likes Received:
    0
    Location:
    North Yorkshire, England
    This is what I used to use back when I used webbrowser

    Code:
    While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
    
                Application.DoEvents()
                System.Threading.Thread.Sleep(200)
    
    End While
    I'd buy/download a book if you want to learn.
     
  16. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    thanks mate just looking at my options now
     
  17. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    so i tried adding this to my code and it exectutes sometimes however after debugging i get this message

    here is the code i implimented
    Code:
    Public Class Form1
         
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim myarray() As String = {"http://google.com", "http://yahoo.com", "http://myspace.com"}
            Dim site As String
    
            For Each site In myarray
    
                WebBrowser1.Navigate(site)
                While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
    
                    Application.DoEvents()
                    System.Threading.Thread.Sleep(200)
    
                End While
    
            Next
            
           
    
    
    
        End Sub
    
        
    End Class
    sometimes it executes sometimes it doesnt, when it does execute it works great, any thoughts from any gurus.
    i have been learning arrays, loops recursions today and am expanding my basic knowledge
    i really want to get this code working damn it
     
    Last edited: Mar 27, 2010
  18. Classytallpaul

    Classytallpaul Newbie

    Joined:
    Oct 6, 2009
    Messages:
    20
    Likes Received:
    27
    Occupation:
    Owner of Winclub.ca - Roulette Coaching
    Location:
    Toronto, Canada
    this will work, i think.........

    Code:
    Dim myarray() As String = {"http://google.com", "http://yahoo.com", "http://myspace.com"}
            Dim i As Integer = myarray.Count() - 1
    
            For p = 0 To i
                     WebBrowser1.Navigate(myarray(p))
                     Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
                                Application.DoEvents()
                      Loop
            Next
     
    Last edited: Mar 27, 2010
  19. crashed

    crashed Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 13, 2008
    Messages:
    958
    Likes Received:
    1,198
    Occupation:
    Guru-slayer
    Location:
    Behind the VPN...
    Home Page:
    Ok, i've spent 10 minutes to write the app for you in VB (I mainly code in C#), its basic, lacking error checking etc but works as i've just run one of my files through it. It covers some pretty nifty techniques including the list(of) variable :D

    Using a do until loop on the webbrowser.readystate is extremely bad practice because
    - It will check it several hundred times a second, and each time it has to allocate memory, load the commands into the processor and unload them afterwards
    - It degrades system performance
    - It can and will cause the app to lock up eventually when you try a big list.

    Have a look at my code, should be ready to run. Each URL needs to be on a seperate line in a text file :D
     

    Attached Files:

    • Thanks Thanks x 1
  20. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    thanks dude appretiated