Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        WebBrowser1.GoHome()
        While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
            Application.DoEvents()
        End While

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Static x As Integer = 0
        Try
            Dim oID As HtmlElement = WebBrowser1.Document.GetElementById("passwd")
            Dim ok As HtmlElement = WebBrowser1.Document.GetElementById("submit")
            oID.SetAttribute("value", Me.RichTextBox1.Lines(x))
            ok.DomElement.click()
            Me.TextBox1.Text = RichTextBox1.Lines(x)
            x += 1
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            Me.Timer1.Enabled = False
        End Try

    End Sub

    Dim myFile As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.Title = "開啟文字檔"
        OpenFileDialog1.Filter = "文字文件(*.txt)|*.txt|所有檔案(*.*)|*.*"

        If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            myFile = OpenFileDialog1.FileName
            RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(myFile, System.Text.Encoding.Default)
            Me.Text = myFile

        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Timer1.Enabled = True
    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        WebBrowser1.Navigate(ToolStripTextBox1.Text)
        While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
            Application.DoEvents()
        End While
    End Sub
End Class

 

文章標籤
全站熱搜
創作者介紹
創作者 alen1985 的頭像
alen1985

1與0的世界

alen1985 發表在 痞客邦 留言(0) 人氣(225)