How to get access to an HTML element in WinForms HTMLUIControl?
HTML elements
The HTML elements are accessed in HTMLUI for developing advanced UIs. The HTML elements are collected in a collection class. The Hashtable, when used as a collection class, stores the HTML elements with a key, specific for each element.
These elements are then assigned to the code variables. The code variables are the objects of the classes, that are responsible for the functionality of the tag elements. These classes contain the definitions for the properties, methods and events for the tag elements. These variables will be used in accessing the HTML elements inside the code.
The following HTML document shows an input tag textbox element with an id as a key for accessing it in the Hashtable.
C#
//declaring the code variable of the tag element //INPUTElementImpl is responsible for the INPUT tag in HTMLUI INPUTElementImpl text; //Collection class accessing the HTML document with the userID as the key Hashtable htmlelements = this.htmluiControl1.Document.GetElementsByUserIdHash(); //Code variable assigned to the html element with the help of the element's id as the key this.text = htmlelements["txt"] as INPUTElementImpl; //usage of the code variable inside the project this.text.UserControl.CustomControl.Text = "HTML Elements in HTMLUI";
VB
'declaring the code variable of the tag element 'INPUTElementImpl is responsible for the INPUT tag in HTMLUI Private text As INPUTElementImpl 'Collection class accessing the HTML document with the userID as the key Private htmlelements As Hashtable = Me.htmluiControl1.Document.GetElementsByUserIdHash() 'Code variable assigned to the html element with the help of the element's id as the key Me.text = CType(IIf(TypeOf htmlelements("txt") Is INPUTElementImpl, htmlelements("txt"), Nothing), INPUTElementImpl) 'usage of the code variable inside the project Me.text.UserControl.CustomControl.Text = "HTML Elements in HTMLUI"