Click here to Skip to main content
16,005,343 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: I need help please Pin
Christian Graus28-Sep-06 0:08
protectorChristian Graus28-Sep-06 0:08 
Questioni want a solution to this problem Pin
jeryes danial27-Sep-06 23:29
jeryes danial27-Sep-06 23:29 
AnswerRe: i want a solution to this problem Pin
Dave Kreskowiak28-Sep-06 5:17
mveDave Kreskowiak28-Sep-06 5:17 
Questiondeploying an application that will call another Pin
steve_rm27-Sep-06 23:21
steve_rm27-Sep-06 23:21 
AnswerRe: deploying an application that will call another Pin
Dave Kreskowiak28-Sep-06 5:16
mveDave Kreskowiak28-Sep-06 5:16 
QuestionDataTable Column Width Pin
zenithmaximus27-Sep-06 22:43
zenithmaximus27-Sep-06 22:43 
AnswerRe: DataTable Column Width Pin
Christian Graus27-Sep-06 23:02
protectorChristian Graus27-Sep-06 23:02 
QuestionHow to automate selection of radio button using vb.net Pin
k_satish27-Sep-06 21:39
k_satish27-Sep-06 21:39 
Imports mshtml
Imports SHDocVw
Imports Automation
Imports InternetMacros



Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(552, 341)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wbbrowser As New SHDocVw.InternetExplorer

wbbrowser.Visible = True
wbbrowser.Navigate("http://elf.meterpower.co.uk/login.asp", Nothing, Nothing, Nothing, Nothing)
Do
Loop Until Not wbbrowser.Busy
LoginIntoSite(wbbrowser)
OpenDownloadDataPage(wbbrowser)
Dim iim As New InternetMacros.Apps


End Sub
Public Sub LoginIntoSite(ByRef wbBrowser As SHDocVw.InternetExplorer)

Dim HTMLDoc As mshtml.HTMLDocument

Do
Loop Until Not wbBrowser.Busy

HTMLDoc = wbBrowser.Document

Dim iHTMLCol As IHTMLElementCollection
Dim iHTMLEle As IHTMLElement
Dim str, groupid, password, userid As String


iHTMLCol = HTMLDoc.getElementsByTagName("input")

'Type Groupid
For Each iHTMLEle In iHTMLCol
If Not iHTMLEle.getAttribute("name") Is Nothing Then
str = iHTMLEle.getAttribute("name").ToString
If str = "groupid" Then
iHTMLEle.setAttribute("value", "")
Exit For
End If
End If
Next

' Type the userid in the password text box
For Each iHTMLEle In iHTMLCol
If Not iHTMLEle.getAttribute("name") Is Nothing Then
str = iHTMLEle.getAttribute("name").ToString
If str = "userid" Then
iHTMLEle.setAttribute("value", "")
Exit For
End If
End If
Next
'Type the password in the password textbox provided
For Each iHTMLEle In iHTMLCol
If Not iHTMLEle.getAttribute("name") Is Nothing Then
str = iHTMLEle.getAttribute("name").ToString
If str = "password" Then
iHTMLEle.setAttribute("value", "")
Exit For
End If
End If
Next

' Press the submit button
For Each iHTMLEle In iHTMLCol
If Not iHTMLEle.getAttribute("name") Is Nothing Then
str = iHTMLEle.getAttribute("name").ToString
If str = "Enter" Then
' If iHTMLEle.outerHTML = "<=href" & _
' " height=21 width=26 " & _
'"border = 0 > " Then
iHTMLEle.click()
Exit For
End If
End If
Next

Do
Loop Until Not wbBrowser.Busy



End Sub
Public Sub OpenDownloadDataPage(ByRef wbBrowser As SHDocVw.InternetExplorer)

Dim HTMLDoc1 As mshtml.HTMLDocument
Dim iHtmlCol As IHTMLElementCollection
Dim iHtmlEle As IHTMLElement
Dim iHtmlIn As mshtml.HTMLInputElement
Dim str1 As String


Do
Loop Until Not wbBrowser.Busy

HTMLDoc1 = wbBrowser.Document
iHtmlCol = HTMLDoc1.getElementsByTagName("a")

' Press the anchor tag to open DownloadData page
For Each iHtmlEle In iHtmlCol
If Not iHtmlEle.outerText Is Nothing Then
If iHtmlEle.outerText.ToLower = "Download Data".ToLower Then
iHtmlEle.click()
Exit For
End If
End If
Next
'Select Radio Buttons . I am using this code to select radio button
'by name demcons and value is kwh. The html code for radio button is as
'followsFrown | :(

For Each iHtmlEle In iHtmlCol
If Not iHtmlEle.getAttribute("name") Is Nothing Then
str1 = iHtmlEle.getAttribute("name").ToString
If str1 = "demcons" Then
MsgBox("hi")
If iHtmlEle.outerHTML = " " Then
iHtmlEle.click()
' MsgBox("hi")


Exit For
End If

End If

End If
Next

' iHtmlCol = HTMLDoc1.getElementsByTagName("input")
' For Each iHtmlIn In iHtmlCol
' If iHtmlIn.name = "demcons" And iHtmlIn.value = "KWH" Then
'iHtmlIn.select()
' End If

' Next

Do
Loop Until Not wbBrowser.Busy

End Sub



End Class


Satishk

AnswerRe: How to automate selection of radio button using vb.net Pin
Christian Graus27-Sep-06 22:09
protectorChristian Graus27-Sep-06 22:09 
QuestionHow can I remove the ENTER space using vb .net? Pin
minniemooo27-Sep-06 21:27
minniemooo27-Sep-06 21:27 
AnswerRe: How can I remove the ENTER space using vb .net? Pin
Guffa27-Sep-06 21:58
Guffa27-Sep-06 21:58 
AnswerRe: How can I remove the ENTER space using vb .net? Pin
Dave Kreskowiak28-Sep-06 5:12
mveDave Kreskowiak28-Sep-06 5:12 
QuestionVB.NET 7.0 Pin
Petricanos27-Sep-06 20:52
Petricanos27-Sep-06 20:52 
AnswerRe: VB.NET 7.0 Pin
Christian Graus27-Sep-06 21:19
protectorChristian Graus27-Sep-06 21:19 
QuestionVB.NET 7.0 Pin
Petricanos27-Sep-06 20:49
Petricanos27-Sep-06 20:49 
AnswerRe: VB.NET 7.0 Pin
Christian Graus27-Sep-06 21:18
protectorChristian Graus27-Sep-06 21:18 
QuestionVB.NET 7.0 Pin
Petricanos27-Sep-06 20:38
Petricanos27-Sep-06 20:38 
AnswerRe: VB.NET 7.0 Pin
Christian Graus27-Sep-06 21:17
protectorChristian Graus27-Sep-06 21:17 
GeneralRe: Code for incremental loops VB.NET 7.0 Pin
Petricanos27-Sep-06 22:13
Petricanos27-Sep-06 22:13 
GeneralRe: Code for incremental loops VB.NET 7.0 Pin
Christian Graus27-Sep-06 23:01
protectorChristian Graus27-Sep-06 23:01 
QuestionDeployment of A program in VB.Net Pin
FriendlySoluations27-Sep-06 20:01
FriendlySoluations27-Sep-06 20:01 
AnswerRe: Deployment of A program in VB.Net Pin
Christian Graus27-Sep-06 21:20
protectorChristian Graus27-Sep-06 21:20 
AnswerRe: Data command problem vb6 Pin
MohammadAmiry27-Sep-06 19:41
MohammadAmiry27-Sep-06 19:41 
GeneralRe: Data command problem vb6 Pin
Christian Graus27-Sep-06 19:48
protectorChristian Graus27-Sep-06 19:48 
GeneralRe: Data command problem vb6 Pin
Christian Graus27-Sep-06 21:14
protectorChristian Graus27-Sep-06 21:14 

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.