Results 1 to 5 of 5

Thread: click checkbox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Question click checkbox

    ok in my webbrowser1 there will be a checkbox is there anyway to click it just bye the test next to it like in this picture it has "Remember me on this computer. " is there a code to click it just by giving it the text that is next to the checkbox ?

  2. #2
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Re: click checkbox

    What do you mean, do you mean you want a Checkbox remember me sort of thing?

    if you do here is mine:

    Code:
    Public Class Login
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
           If CheckBoxChecked() = False Then
                My.Settings.rememberchecked = False
                My.Settings.rememberpass = ""
                My.Settings.rememberuser = ""
            End If
            If CheckBoxChecked() = True Then
                My.Settings.rememberchecked = CheckBox1.Checked
                My.Settings.rememberpass = Password_TextBox.Text
                My.Settings.rememberuser = Username_TextBox.Text
                My.Settings.Save()
            End If
        End Sub
        Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Dim checked As Boolean
            checked = My.Settings.rememberchecked
            If checked = False Then
                Username_TextBox.Text = My.Settings.rememberuser
                Password_TextBox.Text = My.Settings.rememberpass
                CheckBox1.Checked = False
            End If
            If checked = True Then
                Username_TextBox.Text = My.Settings.rememberuser
                Password_TextBox.Text = My.Settings.rememberpass
                CheckBox1.Checked = True
            End If
        End Sub
    
        Private Function CheckBoxChecked() As Boolean
            If CheckBox1.Checked = True Then
                Return True
            End If
            If CheckBox1.Checked = False Then
                Return False
            End If
        End Function
    End Class
    Code:
     ! Make sure you have the settings: rememberuser and rememberpass, rememberchecked and 
    your checkbox is CheckBox1. And the Sign in button is Button1 !

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Re: click checkbox

    No i want to click it thats it i wanted to know if i could click that checkbox just by the text next to it

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: click checkbox

    You can do something like this:

    Code:
            Dim outer As String = WebBrowser1.Document.All("cookieuser").OuterHtml
            WebBrowser1.Document.All("cookieuser").OuterHtml = outer.Remove(outer.Length - 2) + " checked>"
    Where cookieuser is the name of the checkbox.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Re: click checkbox

    i know how to click it with the id for it i wanted to know if i could click it without knowing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width