Results 1 to 10 of 10

Thread: [RESOLVED] VB6 -- Select A Check Box on a WebBrowser

  1. #1

    Thread Starter
    Lively Member wiz....'s Avatar
    Join Date
    Nov 2008
    Location
    Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
    Posts
    78

    Resolved [RESOLVED] VB6 -- Select A Check Box on a WebBrowser

    Hey Guyz...

    I wanted to know how you can select a Radio Button on a WebBrowser1 component on VB6....


    I was actually writing code for a Vb programme that would Fill in Data for me on a WebPage....so often there are these option buttons....i simply couldn't get past through them !!!

    Thnx !!
    PAIN n SUFFERING-Pain is Inevitable,,suffering is optional...........
    WORK EXPECTATION--U can do anything in this world if u don't look for credit.........

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: VB6 -- Select A Check Box on a WebBrowser

    i think set its value to true
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Lively Member wiz....'s Avatar
    Join Date
    Nov 2008
    Location
    Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
    Posts
    78

    Re: VB6 -- Select A Check Box on a WebBrowser

    but How ? it is on a webpage on a webbrowser control !!
    PAIN n SUFFERING-Pain is Inevitable,,suffering is optional...........
    WORK EXPECTATION--U can do anything in this world if u don't look for credit.........

  4. #4
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: VB6 -- Select A Check Box on a WebBrowser

    Quote Originally Posted by wiz.... View Post
    but How ? it is on a web page on a webbrowser control !!
    It's been a while since I played with the WebBrowser control, so I'm no expert with it.
    What I do remember is the following:

    (1) Right click on the web page and click "View Source".
    (2) Search for the HTML code that specifies the name of the OptionButton.
    (3) From the code below replace htmlControlName with the name specified in the html code.

    Code:
    Wb1.Document.All("htmlControlName")(1).Value = True
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  5. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: VB6 -- Select A Check Box on a WebBrowser

    I tried to play with some coding and found something.....

    My HTML code...
    Code:
    <html>
    <body>
    
    <form action="">
    Male: 
    <input type="radio" checked="checked"
    name="Sex" value="male">
    <br>
    Female: 
    <input type="radio"
    name="Sex" value="female">
    </form>
    
    <p>
    Example radiobuttons
    </p>
    
    </body>
    </html>
    Code used for selecting the radiobuttons:
    Code:
    Option Explicit
    
    Private Sub Command1_Click() '~~~> For MALE
    WebBrowser1.Document.All.Item("sex")(0).Checked = True
    End Sub
    
    Private Sub Command2_Click()  '~~~> For FEMALE
    WebBrowser1.Document.All.Item("sex")(1).Checked = True
    End Sub
    
    Private Sub Form_Load()
    WebBrowser1.Navigate "c:\sample.html" '~~~> Load the sample HTML page
    End Sub
    I hope this will give you an idea....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  6. #6
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: VB6 -- Select A Check Box on a WebBrowser

    Quote Originally Posted by akhileshbc View Post
    I tried to play with some coding and found something.....

    Code used for selecting the radiobuttons:
    [CODE]Option Explicit

    Private Sub Command1_Click() '~~~> For MALE
    WebBrowser1.Document.All.Item("sex")(0).Checked = True
    End Sub
    I could be wrong but wouldn't .Checked = True only apply to a CheckBox, not an OptionButton?
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  7. #7
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: VB6 -- Select A Check Box on a WebBrowser

    But it worked... when I run the program....
    You can test it using the above HTML code and VB6 code...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  8. #8
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: VB6 -- Select A Check Box on a WebBrowser

    Here's my working sample.....

    Note: (Adding WebBrowser Control)
    For IE6 users:
    * In Components window, browse and choose ieframe.dll
    For IE7+ users:
    * In Components window, browse and choose shdocvw.dll
    Attached Files Attached Files

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  9. #9

    Thread Starter
    Lively Member wiz....'s Avatar
    Join Date
    Nov 2008
    Location
    Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
    Posts
    78

    Re: VB6 -- Select A Check Box on a WebBrowser

    Thank you guyz !!!!!

    @CDRIVE....thanx....n I actually could have figured out the name of the radio button myself !!!!
    @Akhilesh....thank you bhayyii !!!!
    PAIN n SUFFERING-Pain is Inevitable,,suffering is optional...........
    WORK EXPECTATION--U can do anything in this world if u don't look for credit.........

  10. #10
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: [RESOLVED] VB6 -- Select A Check Box on a WebBrowser

    you are welcome...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Tags for this Thread

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