Coder Profile - Show off your skills, get a coder profile.
 
 
 
  
Posted: 2.60 Years Ago 

Darkvengance
United States
Contrib Level: 8
Total Posts: 549
Ok, so what I am trying to do is make a VB application (just got into VB yesterday woots me!) that will connect to a website, login, and then get some information...

So far I have made it as far as filling in the login info, but I cannot find out how to submit the form!

Just so everyone knows, I cannot use inet (I'm using VB express), I have tried .click and .submit and neither of those worked...any ideas?

PS: Here is the code I have:
CODE: Current code Copy / Restore  ::  Remove Scroll Bars
  1. Public Class Form1
  2.  
  3.     Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
  4.         If WebBrowser1.Url.OriginalString = "http://www.intelcircle.net/login.php" Then
  5.             WebBrowser1.Document.All("Username").InnerText = TextBox1.Text
  6.             WebBrowser1.Document.All("Pass1").InnerText = TextBox2.Text
  7.             WebBrowser1.Document.All("Pass2").InnerText = TextBox3.Text
  8.             WebBrowser1.Document.Forms(0).All("submit").click()
  9.             Label3.Text = "Status: Connected to login page"
  10.         End If
  11.  
  12.     End Sub
  13.  
  14.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  15.         WebBrowser1.Navigate("http://www.somedomain.com/login.php")
  16.         Label3.Text = "Status: Connecting..."
  17.     End Sub
  18. End Class
Posted: 2.59 Years Ago 

Ginger
Norway
Contrib Level: 6
Total Posts: 268
Try looking at the HttpWebRequest object. Since it looks like you are doing a POST operation this link might help you

http://www.netomatix.com/httppostdata.aspx & http://msdn.microsoft.com/en-us/library/debx8sh9.aspx.

Once you get past your login, you will need to be able to get the response data. Tho depending on the authenication mechanism used by the site this may make life difficult.

Doing using a WebBrowser control is painful!


Posted: 2.59 Years Ago 

Darkvengance
United States
Contrib Level: 8
Total Posts: 549
Yeh, I finnally figured out how to do it (Thanks though) I just had to call the tag by ID and then invoke the click function...example below
CODE: Copy / Restore  ::  Remove Scroll Bars
  1. WebBrowser1.Document.GetElementById("submit_button").InvokeMember("click")
Page 1 of 1
 
 
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?

Not enough time to do something productive
I run out of ideas
Too hard to show people my creations
Everything i do has too many errors, and it's too hard
I don't get bored!!!


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.49 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved