[Visual Basic] Login to Gaia with Windows Forms
Info: This is a method of logging into Gaia with out touching the WebBroswer in the Form, but rather using data entered or stored.
PART 1
First i'm going to use Text Boxes.
1. First make a form and include
-Webbroswer
-2 Text Boxes
-Button
http://i55.tinypic.com/6oemax.png
2. Enter this code for the Button.
Code:
Dim user As String
Dim pass As String
user = Me.TextBox1.Text
pass = Me.TextBox2.Text
Me.WebBrowser1.Document.GetElementsByTagName("Input").Item(0).SetAttribute("Value", user)
Me.WebBrowser1.Document.GetElementsByTagName("Input").Item(1).SetAttribute("Value", pass)
Me.WebBrowser1.Document.All("signInButton").InvokeMember("click")
This for form load.
Code:
Me.WebBrowser1.Navigate("http://www.gaiaonline.com")
3. Now first text-box will send the username to Gaia, the second is for the password. Use the button to submit and it will login thanks to this piece of code.
Code:
Me.WebBrowser1.Document.All("signInButton").InvokeMember("click")
Now, "signInButton" is what the Login button for Gaia is called. The code above looks for that element and clicks it to submit.
PART 2
Using Input Boxes
So delete your text boxes. All you need in the form is a single Webbroswer.
So change the code.
(Form1_Load)
Code:
Me.WebBrowser1.Navigate("http://gaiaonline.com")
Dim user As String
Dim pass As String
user = InputBox("GaiaOnline Username", "Username")
pass = InputBox("Gaiaonline Password", "Password")
Me.WebBrowser1.Document.GetElementsByTagName("Input").Item(0).SetAttribute("Value", user)
Me.WebBrowser1.Document.GetElementsByTagName("Input").Item(1).SetAttribute("Value", pass)
Me.WebBrowser1.Document.All("signInButton").InvokeMember("click")
Now what has changed in this is that you are receiving Login Details from Input boxes instead of text boxes.
Code:
user = InputBox("GaiaOnline Username", "Username")
pass = InputBox("Gaiaonline Password", "Password")
So no need for the code in a button, juts put it all in the form Load. So when the second input box is submitted it will activate the form load and use the collected data form the input boxes istead of using the text boxes.
~iShellz
+rep pl0x