I have a Javascript file that has a global variable which is set to some integer value. I load the Javascript in C# using a WebBrowser control. I need to display the value of the global variable in a WinForms Label.
I have tried putting the global variable in a hidden html field and calling the following C# code:
var distance = mapWebBrowser.Document.GetElementsByTagName("input")["distance"];
if (distance != null)
mileageText.Text = Convert.ToString(distance);
But this displays the System.Windows.Forms.HtmlElement
in the label whereas I need the actual value stored inside it.
Can anyone help please?