I have a WebBrowser control on my WinForm, within which I’m showing a dialog box with jQuery that contains a text area and a button labeled “save”, the purpose of which is to obtain data from a user.
When the user clicks the save button I wish to retrieve the text in a text area and store it in a variable in my WinForm application.
Is this possible: jQuery function returning a value to a WinForm application?
Yes it is.
If you plan to use the standard
WebBrowsercontrol for WindowsForm see this property:WebBrowser.ObjectForScripting— There is a very useful example at the bottom showing you exactly how you would execute Javascript that calls back into your application.Personally, I don’t like the supplied WebBrowser control for WinForms or WPF — They are simply COM Wrappers for internet explorer. I prefer to use Awesomium.NET.