We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I get an object for the Control present in an html element in HTMLUI?

 

The GetControlByElement() method of the IInputHTML Interface returns the control present in the specified HTML element. If the HTML element does not contain any controls in it, it returns a null value by default.

C#

//Initializing the respective control's object

private System.Windows.Forms.RadioButton htmlRadioButton;

 private void htmluiControl1_LoadFinished(object sender, System.EventArgs e)

{

 //Collecting the html elements in a hashtable with their key as id

 Hashtable elements = this.htmluiControl1.Document.GetElementsByUserIdHash();

 BaseElement radioElem = (BaseElement)elements["radio1"];

  //Getting the Control from the html element and assigning it to the required object

 //The html element hereafter can be accessed with the help of the htmlRadioButton object

 htmlRadioButton = (RadioButton) this.htmluiControl1.Document.GetControlByElement(radioElem);

}

VB

'Initializing the respective control's object

Private htmlRadioButton As System.Windows.Forms.RadioButton

 Private Sub htmluiControl1_LoadFinished(ByVal sender As Object, ByVal e As System.EventArgs)

 'Collecting the html elements in a hashtable with their key as id

 Dim elements As Hashtable = Me.htmluiControl1.Document.GetElementsByUserIdHash()

 Dim radioElem As BaseElement = CType(elements("radio1"), BaseElement)

  'Getting the Control from the html element and assigning it to the required object

 'The html element hereafter can be accessed with the help of the htmlRadioButton object

 htmlRadioButton = CType(Me.htmluiControl1.Document.GetControlByElement(radioElem), RadioButton)

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
821 04/30/2011 07/10/2014 Windows Forms HTMLUIControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.