Question Login Into a Forums Database

evildude69

New member
Joined
Jul 29, 2013
Messages
1
Location
United States, IL
Programming Experience
Beginner
Hello, I am a new member of this community, so if I make any mistakes while writing this post point them out, and I'll edit them.

My Problem: Alright so I've been trying to create a login form using Visual Studio 2012 which will login to my forum. The whole purpose of that is because I want to make another form with an application that does a certain function, and I want it only to be accessible to my members.

What I Attempted: So as obvious I went to Google for a journey for help. So I read over thousands of posts which weren't quite what I was looking for. The main things I found is: "How to connect to a database" which only connected to a offline database. There is a second way which uses a webbrowser, and a little bit of HTML. Although all this does is select the username, and password box on my forum, and fills it out with the text boxes on my form. So if the webbrowser remembers the info it may not always work. I also made a Yahoo Answer question about this but the guy provided me with instructions on how to do it which I was not able to follow because I am a beginner so I require code examples.

Code Which Partially Got The Job Done:
VB.NET:
[CODE]WebBrowser1.Navigate("[URL="http://www.vbforums.com/"]VBForums - Visual Basic and VB .NET Discussions and More![/URL]")

VB.NET:
WebBrowser1.Document.GetElementById("[the id of the element we want]").SetAttribute("value", "[the value we want the element to contain]")

VB.NET:
WebBrowser1.Document.Forms([the index of the form to be submitted]).InvokeMember("submit")

VB.NET:
PrivateSubbtnLogin_Click(ByValsender AsSystem.Object, ByVale AsSystem.EventArgs) HandlesbtnLogin.Click[COLOR=#333333][FONT=Consolas]    WebBrowser1.Document.GetElementById("navbar_username").SetAttribute("value", txtUsername.Text)[/FONT][/COLOR]
[COLOR=#333333][FONT=Consolas]    WebBrowser1.Document.GetElementById("navbar_password").SetAttribute("value", txtPassword.Text)[/FONT][/COLOR]
[COLOR=#333333][FONT=Consolas]    WebBrowser1.Document.Forms(0).InvokeMember("submit")[/FONT][/COLOR]
EndSub

VB.NET:
PrivateSubWebBrowser1_DocumentCompleted(ByValsender AsObject, ByVale AsSystem.Windows.Forms.WebBrowserDocumentCompletedEventArgs) HandlesWebBrowser1.DocumentCompleted[COLOR=#333333][FONT=Consolas]    WebBrowser1.Document.GetElementById("navbar_username").SetAttribute("value", "Satal Keto")[/FONT][/COLOR]
[COLOR=#333333][FONT=Consolas]    WebBrowser1.Document.GetElementById("navbar_password").SetAttribute("value", "My super duper secret password")[/FONT][/COLOR]
[COLOR=#333333][FONT=Consolas]    WebBrowser1.Document.Forms(0).InvokeMember("submit")[/FONT][/COLOR]
EndSub
[/CODE]

So I hope you will be able to understand my issue, and will be able to provide me with support. I would strongly appreciate any suggestion or tips provided on resolving this problem.
 
Back
Top