VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 300,331 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,815 people online right now. Registration is fast and FREE... Join Now!




Logging into a website

 

Logging into a website

dreadfear

8 Jan, 2009 - 05:09 AM
Post #1

D.I.C Head
**

Joined: 8 Dec, 2008
Posts: 166



Thanked: 1 times
My Contributions
Im trying to login to my website with vb.net (without the use of java script).

CODE
webbrowser.documents.forms(0).submit


All i can find on the internet is to use that there to click the login button but it doesn't work.

I also found this for filling in the login forms but im having trouble understanding how it works.

CODE
      Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
              WebBrowser1.Document.All("txtUser").SetAttribute("value", "myusername")
              WebBrowser1.Document.All("txtPassword").SetAttribute("value", "mypassword")
              WebBrowser1.Document.All("btnSubmit").InvokeMember("click")
          End Sub


So if anyone could explain to me how to fill a form or how to click a submit button then that would be greatly appreciated.

NOTE: I can do this in javascript so please dont post javascript.

User is offlineProfile CardPM
+Quote Post


chrixko

RE: Logging Into A Website

8 Jan, 2009 - 11:44 PM
Post #2

New D.I.C Head
*

Joined: 25 Nov, 2008
Posts: 48



Thanked: 7 times
My Contributions
Hey, try this :

add a webbrowser to you Form
CODE


Webbrowser1.Navigate("www.yourhomepage.com/input.php")
'Link just an example

If Webbrowser1.ReadyState = WebBrowserReadyState.Complete
        webBrowser1.Document.All("txtUsername").SetAttribute("value", "Username")
        webBrowser1.Document.All("txtPassword").SetAttribute("value", "mypass01")
' This fills the controls with your values
' But you need the name of the Control for the parameter ..Document.all(name of the control)...

        webBrowser1.Document.Forms(0).InvokeMember("submit")
'This calls the submit



This post has been edited by chrixko: 9 Jan, 2009 - 03:14 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 04:22PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month