仅编译应用程序源可用

时间:2011-12-29 18:17:52

标签: vb.net

我正在尝试编译一些我为我想要使用的应用程序找到的代码。 现在我下载VB.NET express创建了一个新项目,只是用我得到的代码替换了代码,但这根本不是创建表单(textfields等),所以我无法编译它。 这是正常的吗?我还需要做些什么才能编译它。

这是源代码:

Public Class Form1
    Dim psc As String
    Dim pwchange As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not My.Settings.pw_save = "" Then
            TextBox6.Text = My.Settings.pw_save
            CheckBox2.CheckState = CheckState.Checked
        End If
        If Not My.Settings.new_pw_save = "" Then
            TextBox7.Text = My.Settings.new_pw_save
            CheckBox1.CheckState = CheckState.Checked
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Document.GetElementById("mainPagePart:verifyCaptcha").InnerText = TextBox5.Text


        'Die 1. - 5. Zahlenkombi
        WebBrowser1.Document.GetElementById("mainPagePart:rn1").InnerText = TextBox1.Text
        WebBrowser1.Document.GetElementById("mainPagePart:rn2").InnerText = TextBox2.Text
        WebBrowser1.Document.GetElementById("mainPagePart:rn3").InnerText = TextBox3.Text
        WebBrowser1.Document.GetElementById("mainPagePart:rn4").InnerText = TextBox4.Text

        'Button bestätigen
        'WebBrowser1.Document.Forms(0).InvokeMember("submit")

        'Passwort Eingabe
        WebBrowser1.Document.GetElementById("mainPagePart:passField").InnerText = TextBox6.Text
        'WebBrowser1.Document.GetElementById("mainPagePart:next").InvokeMember("submit")
        'Abfrage ob richtige Captcha Eingabe
        'WebBrowser1.Document.GetElementById("mainPagePart:next").SetAttribute("value", "Free")
        WebBrowser1.Document.GetElementById("mainPagePart:next").Focus()
        SendKeys.Send("{ENTER}")

        psc = 1
        'Dim wert As HtmlElement = WebBrowser1.Document.GetElementById("j_id66")
        'MessageBox.Show(wert.InnerText)

    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        Me.WebBrowser1.Document.Window.ScrollTo(50, 342)
        If psc = 1 Then
            'Dim wert As HtmlElement = WebBrowser1.Document.GetElementById("j_id66")
            ' Dim wert As HtmlElement = WebBrowser1.Document.GetElementFromPoint()
            'MessageBox.Show(wert.InnerText)
            Me.WebBrowser1.Document.Window.ScrollTo(150, 310)
            psc = 0
            If WebBrowser1.DocumentText.Contains("Bei deinem PIN-Code und/oder Passwort ist ein Fehler aufgetreten. Bitte überprüfe die korrekte Eingabe des PIN-Codes oder Passworts.") Then
                Label1.Text = "Pin oder Passwort Falsch"
                psc = 0
                Label1.ForeColor = Color.Red
                Me.WebBrowser1.Document.Window.ScrollTo(100, 370)
                'WebBrowser1.Navigate("https://customer.cc.at.paysafecard.com/psccustomer/GetWelcomePanelServlet?&language=de&javax.faces.ViewState=j_id1")
            ElseIf WebBrowser1.DocumentText.Contains("Bei der Eingabe des PIN-Codes oder Passworts ist ein Fehler aufgetreten. Bitte korrigiere deine Eingabe. Hast du ein Passwort für diese paysafecard vergeben, kontaktiere bitte unser Service-Team.") Then
                Label1.Text = "Pin oder Passwort Falsch"
                psc = 0
                Label1.ForeColor = Color.Red
                Me.WebBrowser1.Document.Window.ScrollTo(100, 370)
                'Abfrage ob richtige Pin-Code Eingabe
            ElseIf WebBrowser1.DocumentText.Contains("Bitte korrigiere deine Eingabe") Then
                Label1.Text = "Pin oder Passwort Falsch"
                psc = 0
                Label1.ForeColor = Color.Red
                Me.WebBrowser1.Document.Window.ScrollTo(100, 370)
            ElseIf WebBrowser1.DocumentText.Contains("Der eingegebene Text stimmt nicht mit dem Angezeigten überein.") Then
                Label1.Text = "Captcha falsch"
                Label1.ForeColor = Color.Red
                psc = 0
                Me.WebBrowser1.Document.Window.ScrollTo(120, 350)
                'WebBrowser1.Navigate("https://customer.cc.at.paysafecard.com/psccustomer/GetWelcomePanelServlet?&language=de&javax.faces.ViewState=j_id1")
            ElseIf WebBrowser1.DocumentText.Contains("Verfügbares Guthaben") Then
                Label1.ForeColor = Color.Green
                Label1.Text = "PSC OK"
            End If
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        WebBrowser1.Document.GetElementById("tabForm:password").Focus()
        SendKeys.Send("{ENTER}")
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If WebBrowser1.DocumentText.Contains("passwordPage:passwordOld") And Not pwchange = 1 Then
            WebBrowser1.Document.GetElementById("passwordPage:passwordOld").InnerText = TextBox6.Text
            WebBrowser1.Document.GetElementById("passwordPage:password1").InnerText = TextBox7.Text
            WebBrowser1.Document.GetElementById("passwordPage:password2").InnerText = TextBox7.Text
            pwchange = 1
            WebBrowser1.Document.GetElementById("passwordPage:submit").Focus()
            SendKeys.Send("{ENTER}")
            Label5.Text = "Das neue Passwort lautet:" & TextBox7.Text
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        WebBrowser1.Document.GetElementById("tabForm:close").Focus()
        SendKeys.Send("{ENTER}")
        Label5.Text = ""
        Label1.Text = ""
    End Sub

    Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
        If TextBox8.TextLength = 16 Then
            TextBox1.Text = TextBox8.Text.Substring(0, 4)
            TextBox2.Text = TextBox8.Text.Substring(4, 4)
            TextBox3.Text = TextBox8.Text.Substring(8, 4)
            TextBox4.Text = TextBox8.Text.Substring(12, 4)
        End If
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.CheckState = CheckState.Checked Then
            My.Settings.new_pw_save = TextBox7.Text
        Else
            My.Settings.new_pw_save = ""
        End If

    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.CheckState = CheckState.Checked Then
            My.Settings.pw_save = TextBox6.Text
        Else
            My.Settings.pw_save = ""
        End If
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

从快速浏览一下代码,您需要一个与代码一致的表单,以便为应用程序提供UI。如果您自己设计,请记住使用事件对话框并连接您需要的每个事件。