Click here to Skip to main content
15,891,936 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: CheckBox column in DataGridView Pin
ivo7518-Oct-09 1:53
ivo7518-Oct-09 1:53 
GeneralRe: CheckBox column in DataGridView Pin
dan!sh 18-Oct-09 11:29
professional dan!sh 18-Oct-09 11:29 
GeneralRe: CheckBox column in DataGridView Pin
Dambod18-Oct-09 19:53
Dambod18-Oct-09 19:53 
QuestionAdding events to line (shape) Pin
helelark12317-Oct-09 23:26
helelark12317-Oct-09 23:26 
AnswerRe: Adding events to line (shape) Pin
dan!sh 18-Oct-09 0:55
professional dan!sh 18-Oct-09 0:55 
GeneralRe: Adding events to line (shape) Pin
helelark12318-Oct-09 1:10
helelark12318-Oct-09 1:10 
GeneralRe: Adding events to line (shape) Pin
dan!sh 18-Oct-09 1:19
professional dan!sh 18-Oct-09 1:19 
QuestionLogin Authentication help would be appreciated Pin
spamnchips17-Oct-09 2:46
spamnchips17-Oct-09 2:46 
I have written a program in VB 2008 Express to call up my ADSL Router, login, access and save some traffic statistics. The partial code shown below has been gleaned from the interent/forums as a means to automatically login to the router. Unfortunately, this routine does not work. When the webbrowser1.navigate command is issued the router responds with another form requiring the login user name and password (these are required in unencrptyed text). The document.completed event is never reached as control is taken away from my program and held by the Internet Explore pop up page. I have tried a number of ideas but cannot overcome this proble. Is there an experienced coder who can offer some valuable advise please ?

code:

Imports System
Imports System.Net
Public Class Form1
Dim username, pswd As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Part 1: Use WebBrowser control to load web page

WebBrowser1.Navigate("http://192.168.1.1/")

End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
username = "admin" : pswd = "admin"
' Part 2: Automatically input username and password

Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")

For Each curElement As HtmlElement In theElementCollection

Dim controlName As String = curElement.GetAttribute("name").ToString

If controlName = "username" Then

' curElement.GetAttribute("Value")

curElement.SetAttribute("Value", username)

ElseIf controlName = "password" Then

curElement.SetAttribute("Value", pswd)

End If

Next

' Part 3: Automatically click the Login button

Dim theWElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")

For Each curElement As HtmlElement In theWElementCollection

If curElement.GetAttribute("value").Equals("Login") Then

curElement.InvokeMember("click")

' javascript has a click method for we need to invoke on the current submit button element.

End If

Next

End Sub

End Class
AnswerRe: Login Authentication help would be appreciated Pin
Dave Kreskowiak18-Oct-09 2:17
mveDave Kreskowiak18-Oct-09 2:17 
GeneralRe: Login Authentication help would be appreciated Pin
spamnchips19-Oct-09 23:39
spamnchips19-Oct-09 23:39 
Questionclr20r3 problem Pin
TheComputerMan17-Oct-09 0:51
TheComputerMan17-Oct-09 0:51 
AnswerRe: clr20r3 problem Pin
Dave Kreskowiak17-Oct-09 5:56
mveDave Kreskowiak17-Oct-09 5:56 
GeneralRe: clr20r3 problem Pin
TheComputerMan17-Oct-09 12:12
TheComputerMan17-Oct-09 12:12 
GeneralRe: clr20r3 problem Pin
Dave Kreskowiak17-Oct-09 15:21
mveDave Kreskowiak17-Oct-09 15:21 
GeneralRe: clr20r3 problem Pin
TheComputerMan18-Oct-09 1:27
TheComputerMan18-Oct-09 1:27 
GeneralRe: clr20r3 problem Pin
Dave Kreskowiak18-Oct-09 2:15
mveDave Kreskowiak18-Oct-09 2:15 
GeneralRe: clr20r3 problem Pin
Eddy Vluggen18-Oct-09 0:45
professionalEddy Vluggen18-Oct-09 0:45 
AnswerRe: clr20r3 problem Pin
0x3c017-Oct-09 6:43
0x3c017-Oct-09 6:43 
QuestionSerial code login Pin
offroaderdan16-Oct-09 3:55
offroaderdan16-Oct-09 3:55 
AnswerRe: Serial code login Pin
Dave Kreskowiak16-Oct-09 4:50
mveDave Kreskowiak16-Oct-09 4:50 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 5:02
offroaderdan16-Oct-09 5:02 
GeneralRe: Serial code login Pin
Dave Kreskowiak16-Oct-09 5:22
mveDave Kreskowiak16-Oct-09 5:22 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 5:28
offroaderdan16-Oct-09 5:28 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 5:35
offroaderdan16-Oct-09 5:35 
GeneralRe: Serial code login Pin
EliottA16-Oct-09 5:44
EliottA16-Oct-09 5:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.