|
-
Aug 1st, 2008, 07:28 PM
#1
Thread Starter
Lively Member
[RESOLVED] Clicking a button on the Webbrowser.
OK guys , I know how to click a normal button with the Name property, but I have a listbox and a button next to it. I can select an item from the listbox - no problem, but I want to be able to click the button as well.
The code for the button is this:
Code:
<input class="btnlite" type="submit" value="Go" />
Could anyone help me?
-
Aug 2nd, 2008, 07:45 AM
#2
Re: Clicking a button on the Webbrowser.
Is this button on a web page that you developed?
-
Aug 2nd, 2008, 11:42 AM
#3
Re: Clicking a button on the Webbrowser.
Are you using a web browser control on your form to house the webpage? We need a bit more info.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2008, 03:20 PM
#4
Thread Starter
Lively Member
Re: Clicking a button on the Webbrowser.
@ Hack:
No, I'm a mod on a site, and there's some quick-mod tools in a listbox. I'm trying to get it to lock the topic, which is one of the options in the listbox and then post a message saying it was locked.
I can make it post the message and change the listbox to the Lock one, but I can't figure out how to push that button.
Here is the entire code for the listbox and things.
HTML Code:
<td width="40%" valign="top" nowrap="nowrap" align="left"><form method="post" action="this goes to a mod page."><span class="gensmall">Quick-mod tools:</span> <select name="action" id="quick-mod-select"><option value="lock">Lock topic</option><option value="delete_topic">Delete topic</option><option value="move">Move topic</option><option value="split">Split topic</option><option value="merge">Merge posts</option><option value="merge_topic">Merge topic</option><option value="fork">Copy topic</option><option value="make_sticky">Change to “Sticky”</option><option value="make_announce">Change to “Announcement”</option><option value="make_global">Change to “Global”</option><option value="topic_logs">View logs</option></select> <input class="btnlite" type="submit" value="Go" /></form></td>
@Robdog:
Yes, the web browser is on my form. I click a button and the browser navigate to the login page, it logs in then it posts the locked message and then finally locks it (which I can't figure out how to do).
-
Aug 2nd, 2008, 06:00 PM
#5
Re: Clicking a button on the Webbrowser.
You can use the documents DOM to submit the form (click button).
Some examples...
http://www.vbforums.com/showthread.php?t=330341
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2008, 07:28 PM
#6
Thread Starter
Lively Member
Re: Clicking a button on the Webbrowser.
I'll take a look, thanks
-
Aug 2nd, 2008, 08:00 PM
#7
Thread Starter
Lively Member
Re: Clicking a button on the Webbrowser.
I can't figure it out. Could you help me out a bit more? Cheers.
-
Aug 2nd, 2008, 08:09 PM
#8
Re: Clicking a button on the Webbrowser.
This post of that thread has the DOM example.
http://www.vbforums.com/showpost.php...6&postcount=56
also, if your button has a name or id then you can simply...
WebBrowser1.Document.All.btnSubmit.Click
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2008, 08:23 PM
#9
Thread Starter
Lively Member
Re: Clicking a button on the Webbrowser.
 Originally Posted by RobDog888
Yeah, I knew about WebBrowser1.Document.All.btnSubmit.Click I use that to login, I think. The button doesn't have either of them, I don't think.
I had a look at the topic you gave me before, but the form still wasn't submitting. However, the site is getting a few 500 errors lately and that might be the reason.
I looked at this code in the project
'Submit the first (and only) form in the page
WebBrowser1.Document.Forms.Item(0).submit
but I don't know how I would integrate the html form into that.
The form starts like this, I think
<form method="post"
When I looked through the source code of the page, there was two other examples of this. Both of them were after the one I wanted. Do you know if it would be possible to submit the form using that code?
-
Aug 2nd, 2008, 08:29 PM
#10
Re: Clicking a button on the Webbrowser.
Since there is no button name or id you may have to iterate through the elements to get the desired button. You could also do it the flakey way by using SendKeys but with IE7/Vista it wont work.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2008, 08:43 PM
#11
Thread Starter
Lively Member
Re: Clicking a button on the Webbrowser.
 Originally Posted by RobDog888
Since there is no button name or id you may have to iterate through the elements to get the desired button. You could also do it the flakey way by using SendKeys but with IE7/Vista it wont work.
I guess I'll have to do that, then.
Thanks so much for your help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|