|
-
Feb 28th, 2010, 12:13 AM
#1
Thread Starter
New Member
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.
-
Feb 28th, 2010, 01:25 AM
#2
Hyperactive Member
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.
-
Feb 28th, 2010, 01:38 AM
#3
Thread Starter
New Member
Re: HTMLelements and if statements vb 2008
 Originally Posted by The Fire Snake
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.
-
Feb 28th, 2010, 01:41 AM
#4
Thread Starter
New Member
Re: HTMLelements and if statements vb 2008
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|