Home > Uncategorized > Iterating HTMLSelectElement options in C# And VB.NET

Iterating HTMLSelectElement options in C# And VB.NET

If you want to list all the values of options in a HTML drop down list, from a webbrowser control in VB.NET or C#, here’s how to do it:

Dim hoeDest As HTMLOptionElement
For iDest = 0 To hseDestinations.options.length – 1
hoeDest = hseDestinations.options.item(iDest)
tbOutput.Text += hoeDest.value
Next iDest

Or in C#

for (var iDest = 0; iDest <= destinationSelect.Children.Count – 1; iDest++)
{
var hoeDest = (HTMLOptionElement)destinationSelect.Children[iDest].DomElement;
tbOutput.Text += hoeDep.value;
}

 

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: