-
Oct 18th, 2012, 03:01 PM
#1
Thread Starter
Member
Need help.... Went from WinForms to WPF. RE: WebBrowser - Click submit
So I've went from a winform with my app to a new WPF version because I've wanted to to a ribbon.
So I never used WPF before and pretty much took a crash course in the over the last couple of weeks. Everything has went smootly up until the last 48hrs.
All I need to do it click "submit" on a form/ webpage inside of the WPF webbrowser. (TALK ABOUT A NITEMARE!)
Old way that worked perfectly:
wbGetHost.Document.All("get_host_info").Focus() ' Focus on textbox in form
wbGetHost.Document.All("get_host_info").InnerText = rgServers.SelectedItem 'Set text of textbox
wbGetHost.Document.GetElementById("Submit").InvokeMember("Click") ' Click submit button
Everything works except the "click" event and I cant find anything on how to get it to work.
Thanks for any help!
Adam
-
Oct 22nd, 2012, 01:36 PM
#2
Thread Starter
Member
Re: Need help.... Went from WinForms to WPF. RE: WebBrowser - Click submit
Wow... no one knows how to click a button in WPF??
Well I guess I dont see so dumb after all...
-
Nov 29th, 2012, 07:00 AM
#3
Member
Re: Need help.... Went from WinForms to WPF. RE: WebBrowser - Click submit
some people don't
Last edited by ahmedkhairy; Nov 29th, 2012 at 07:04 AM.
-
Dec 16th, 2012, 11:06 PM
#4
Re: Need help.... Went from WinForms to WPF. RE: WebBrowser - Click submit
Hi,
In my WPF webbrowser loadcompleted event, I loaded google.com's page
and then performing a search on that page by posting a value in it's
search textbox, and then clicking it's search button.
This uses mshtml namespace.
Code:
HTMLDocument document = (HTMLDocument)wbGetHost.Document;
HTMLInputElement searchText = (HTMLInputElement)document.getElementById("q");
searchText.value = "Bill Gates";
HTMLInputElement searchButton = (HTMLInputElement)document.all.item("btnK", 0);
searchButton.click();
You can include some trappings/snippets to meet your needs...
Greg
Last edited by KGComputers; Dec 17th, 2012 at 12:44 AM.
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
|