Results 1 to 4 of 4

Thread: HTMLelements and if statements vb 2008

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    15

    HTMLelements and if statements vb 2008

    Well I hope this is the right section since I can't figure out where to post for vb 2008 express. Anyway I'm trying to get my program to search for a html element and if it finds it, do something. I just started programming vb yesturday and have little programming knowledge. I'm learning as I go and thats how I learn.

    Code:
      Private Sub Connect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Connect.Click
            WebBrowser1.Navigate(AdressBox.Text)
            Dim Element As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName(tagName:="login")
            ' If (Element) Then
    
            ' End If
        End Sub
    I keep getting a null reference error no matter what combinations I try. I want it to search for the login name and if there is one then do the login procedure I have setup. I want to do this for a image later but I need to learn this first. I know that this tag name = login and is NOT a id. Any help is good thanks. Oh I do my research and wouldn't ask if I felt like I could find it.

  2. #2
    Hyperactive Member The Fire Snake's Avatar
    Join Date
    Sep 2009
    Location
    USA
    Posts
    401

    Re: HTMLelements and if statements vb 2008

    How is your interface coded? Are you using ASP.Net to display this login page, Silverlight etc? There are so many technologies, frameworks and tools these days, its hard to advise untill we know exactly how you are doing things in your project. It you are using ASP.NET then you wouldn't need to look for a tag name, but when your connect button was clicked(i.e. on its click event as you have posted above) you would look at the contents of the textbox variable(aka control) and then do some kind of credentials check.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    15

    Re: HTMLelements and if statements vb 2008

    Quote Originally Posted by The Fire Snake View Post
    How is your interface coded? Are you using ASP.Net to display this login page, Silverlight etc? There are so many technologies, frameworks and tools these days, its hard to advise untill we know exactly how you are doing things in your project. It you are using ASP.NET then you wouldn't need to look for a tag name, but when your connect button was clicked(i.e. on its click event as you have posted above) you would look at the contents of the textbox variable(aka control) and then do some kind of credentials check.
    Im just using the webbrowser control and pulling html elements that way. I already have it login but I want it to check if the login screen is there and if it is login and if not continue program.

    I've made some changes to the code and now it is...

    Code:
      Private Sub Connect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Connect.Click
            WebBrowser.Navigate(AdressBox.Text)
    
            
            While WebBrowser.ReadyState <> WebBrowserReadyState.Complete
                Application.DoEvents()
            End While
        --->    If Me.WebBrowser.Document.All.GetElementsByName("lpass") Then
            End If
    
        End Sub
    I'm now trying to figure out why this is trying to convert to boolean on the line with a arrow pointing. Like I said I want to search for a element with every page load and if it exists do something and if not do something else
    Last edited by RedBison; Feb 28th, 2010 at 01:41 AM.

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    15

    Re: HTMLelements and if statements vb 2008

    Sorry I double posted

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