Articles in this section
Category / Section

How to retrieve the selected value from the Select tag in WinForms HTMLUIControl?

1 min read

Select tag in HTMLUI

We can retrieve the selected value from the Select tag by retrieving the SelectedItem property of the SELECTElementImpl''s embedded CustomControl.

C#

private void button1_Click(object sender, EventArgs e)
{
     SELECTElementImpl htmlElement = (SELECTElementImpl)this.htmluiControl1.Document.GetElementByUserId("Select1");
     ListBox list = htmlElement.UserControl.CustomControl as ListBox;
     this.textBox1.Text = (string)list.SelectedItem;
}

 

VB

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
     Dim htmlElement As SELECTElementImpl = CType(Me.htmluiControl1.Document.GetElementByUserId("Select1"), SELECTElementImpl)
     Dim list As ListBox = TryCast(htmlElement.UserControl.CustomControl, ListBox)
     Me.textBox1.Text = CStr(list.SelectedItem)
End Sub

Reference link: https://help.syncfusion.com/windowsforms/html-viewer/html-tags#select---select-tag

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied