Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
Posts
78
[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.........
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
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.........
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.
<--- 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??
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
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??
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
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
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
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.........
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