[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 !!
Re: VB6 -- Select A Check Box on a WebBrowser
i think set its value to true
Re: VB6 -- Select A Check Box on a WebBrowser
but How ? it is on a webpage on a webbrowser control !!
Re: VB6 -- Select A Check Box on a WebBrowser
Quote:
Originally Posted by
wiz....
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
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.... :wave:
Re: VB6 -- Select A Check Box on a WebBrowser
Quote:
Originally Posted by
akhileshbc
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?
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... :wave:
1 Attachment(s)
Re: VB6 -- Select A Check Box on a WebBrowser
Here's my working sample..... :wave:
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
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 !!!!
Re: [RESOLVED] VB6 -- Select A Check Box on a WebBrowser
you are welcome... :wave: