Jump to content
Rodrigo Labora

Problema WebBrowser e Text box

Recommended Posts

Rodrigo Labora

Boa Tarde ando a ja uns dias a procurar uma soluçao em diversos sites e no youtube através de videos mas nao encontrei nada que fizesse o webbrowser de outro form usasse o textbox do form1 como eu poderia fazer para que o web browser quando usase a string username fosse buscar a informaçao que estava escrita no form 1 no textbox3 e a password no texbox2

esta é o meu código do form1

Public Class Form1

    Public Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        segundos.Text += 1
        If segundos.Text = "60" Then
            minutos.Text += 1
            segundos.Text = 0
        End If
        If minutos.Text = "60" Then
            horas.Text += 1
            minutos.Text = 0
        End If
    End Sub
    Public Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Timer1.Enabled = False
        Timer1.Stop()
        Button1.Enabled = True
        Button7.Enabled = False
    End Sub

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        form2.Show()
        TrackBar1.Minimum = 0
        TrackBar1.Maximum = 100
        TrackBar2.Minimum = 0
        TrackBar2.Maximum = 100
        TrackBar1.Value = 35
        TrackBar2.Value = 100

    End Sub

    Public Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Static i As Integer

        i += 1
        form2.Show()
        If i >= ImageList1.Images.Count Then
            i = 0
            form2.Hide()
        End If

        Button9.BackgroundImage = ImageList1.Images(i)
    End Sub

    Public Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Form3.Show()

    End Sub

    Public Sub License_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles License.Click
        TabControl1.SelectedTab = TabPage4
    End Sub

    Public Sub Map_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Map.Click
        TabControl1.SelectedTab = TabPage1

    End Sub

    Public Sub Settings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Settings.Click
        TabControl1.SelectedTab = TabPage2
    End Sub

    Public Sub Stats_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stats.Click
        TabControl1.SelectedTab = TabPage3
    End Sub

    Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Static i As Integer

        If TextBox1.Text = "pika_bot2019" Then
            i = 0
            Label4.Visible = True
            Label3.Visible = False
            Label4.Enabled = True
            Label3.Enabled = False
            Button3.BackgroundImage = ImageList2.Images(i)
            Button4.BackgroundImage = ImageList2.Images(i)
        Else
            MsgBox("Invalid License")
            Label4.Visible = False
            Label4.Enabled = False
            Label3.Visible = True
            Label3.Enabled = True

        End If
    End Sub

    Public Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        TabControl2.SelectedTab = TabPage5
    End Sub

    Public Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        TabControl2.SelectedTab = TabPage6

    End Sub

    Public Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        TabControl2.SelectedTab = TabPage7
    End Sub

    Public Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        TabControl2.SelectedTab = TabPage8
    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If Label4.Enabled = True Then
            Button1.Enabled = False
            Button7.Enabled = True
            Timer1.Enabled = True
            Timer1.Start()
        Else
            Label3.Enabled = True
            Form4.Show()
        End If
    End Sub

    Public Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Dim dialog As DialogResult
        dialog = MessageBox.Show("Are you sure you want to exit?", "Alert", MessageBoxButtons.YesNo)
        If dialog = DialogResult.No Then
            e.Cancel = True
        Else
            Application.ExitThread()
        End If
    End Sub

    Public Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        TabControl3.SelectedTab = TabPage10
    End Sub

    Public Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        TabControl3.SelectedTab = TabPage11
    End Sub

    Public Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        TabControl3.SelectedTab = TabPage12
    End Sub

    Public Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        TabControl3.SelectedTab = TabPage13
    End Sub

    Public Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        TabControl3.SelectedTab = TabPage14
    End Sub

    Public Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
        TabControl3.SelectedTab = TabPage15
    End Sub

    Public Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
        TabControl3.SelectedTab = TabPage16
    End Sub

    Public Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click
        TabControl3.SelectedTab = TabPage17
    End Sub

    Public Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
        TabControl3.SelectedTab = TabPage18
    End Sub

    Public Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click
        TabControl3.SelectedTab = TabPage19
    End Sub

    Public Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
        TabControl3.SelectedTab = TabPage20
    End Sub

    Public Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
        TabControl3.SelectedTab = TabPage21
    End Sub

    Public Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
        TabControl3.SelectedTab = TabPage22
    End Sub

    Public Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
        If CheckBox6.Checked Then
            NumericUpDown1.Enabled = True
            Label7.Enabled = True
        Else
            NumericUpDown1.Enabled = False
            Label7.Enabled = False
        End If
    End Sub

    Public Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        Label8.Text = TrackBar1.Value.ToString()
    End Sub

    Public Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.Scroll
        Label10.Text = TrackBar2.Value.ToString()
    End Sub

End Class


este é o codigo do form3

Public Class Form3
    Dim didWeNavigated? As Boolean = False                                                               
    Dim gottheserver? As Boolean = False                                                                    
    Public Property ScriptErrorsSuppressed As Boolean
    Public Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
    End Sub

    Public Sub WebBrowser2_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
        If didWeNavigated = False Then                                                                     
            Exit Sub
        End If
        If didWeNavigated = True Then didWeNavigated = False
        Dim username As String = TextBox3.Text                                                             
        Dim password As String = TextBox2.Text                                                             
        WebBrowser2.Document.GetElementById("bgcdw_login_form_username").SetAttribute("Value", username)   that text field.
        WebBrowser2.Document.GetElementById("bgcdw_login_form_password").SetAttribute("Value", password)   text field.

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send("{ENTER}")
        Timer1.Stop()
    End Sub
End Class

 

Share this post


Link to post
Share on other sites
programadorvb6

Foi escrito em vb.net por mim envia dados para uma pagina web,
nota : nem sempre a  username  e password nas páginas web têm o mesmo valor.
Link : https://app.box.com/s/sp3114kb90ebrf1icrqzotoia7l6krrj

Edited by programadorvb6

______________________________________________________________________________

Que minha coragem seja maior que meu medo e que minha força seja tão grande quanto minha fé.
 

Share this post


Link to post
Share on other sites
Rodrigo Labora

sim mas o textbox3 e 2 estao no form 1 logo o webBrowser que se encontra no form 3 na o consegue ler

 

Share this post


Link to post
Share on other sites
programadorvb6

Olá Rodrigo tens aqui um exemplo, basta carregares a página e lá clicas com o botão do rato onde queres que te dê os valores no navegador.
Espero ter ajudado.

Imagem : Imagem

Link :   Codigo em VB.net 2012


______________________________________________________________________________

Que minha coragem seja maior que meu medo e que minha força seja tão grande quanto minha fé.
 

Share this post


Link to post
Share on other sites
programadorvb6

Como Funciona aqui está um exemplo via Youtube.

Como Funciona : Link


______________________________________________________________________________

Que minha coragem seja maior que meu medo e que minha força seja tão grande quanto minha fé.
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.