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.
:sick:
Thanks for any help!
Adam
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...
Re: Need help.... Went from WinForms to WPF. RE: WebBrowser - Click submit
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