Here's my code

Dim allelementds As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
                For Each DD As HtmlElement In allelementds
                    If DD.OuterHtml.Contains("resource") Then
                        TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))
                    End If
                Next
                LblHel.Text = TlsResourceComboBox.Items.Item(0).ToString
                LblIro.Text = TlsResourceComboBox.Items.Item(1).ToString
                LblOxy.Text = TlsResourceComboBox.Items.Item(2).ToString
                LblWat.Text = TlsResourceComboBox.Items.Item(3).ToString

As you can see im currently using a combobox as a type of a list which uses index to give certain labels their text
I know that there are only 4 indexes when getting the inner text so how can put those 4 indexes into a sort of list
without me using a Combobox lol XD

You can use a Dictionary to store things. A Dictionary consists of name/value pairs where the name is used as the index (key). The value part can be of any type, even objects and custom classes. When you create a dictionary object you declare the type of the key and value as follows

Dim mydict As New Dictionary(Of <type>, <type>)

For example you could declare a dictionary to hole employee names keyed by employee number as follows:

Dim empdict As New Dictionary(Of Integer, String)

and you would add entries as

empdict.Add(1024, "Jetson, George")

You can access the values as

Msgbox(empdict(1024))

Check out the documentation for all the features.

hay im struggeling can you help me

Dim allelementds As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
        For Each DD As HtmlElement In allelementds
            If DD.OuterHtml.Contains("resource") Then
                TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))
                Dim empdict As New Dictionary(Of Integer, String)
                empdict.Add(1, DD.GetAttribute("InnerText"))
                empdict.Add(2, DD.GetAttribute("InnerText"))
                empdict.Add(3, DD.GetAttribute("InnerText"))
                empdict.Add(4, DD.GetAttribute("InnerText"))
                '  LblHel.Text = empdict(1)
                '    LblIro.Text = empdict(2)
                ' LblOxy.Text = empdict(3)
                ' LblWat.Text = empdict(4)
            End If
        Next

if i use msgbox it gives all four so how can i accees each one of them -_-
that was an idea but yes didnt work

Edited 4 Years Ago by VB 2012

If you just want to index by number and you know how many items there are in the list then you can just use an array as in

Dim allelements As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
Dim labels(3) As String
Dim item As Integer = 0

For Each DD As HtmlElement In allelements
    If DD.OuterHtml.Contains("resource") Then
        TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))
        labels(item) = DD.GetAttribute("InnerText"))
        item += 1
    End If
Next

LblHel.Text = labels(0)
LblIro.Text = labels(1)
LblOxy.Text = labels(2)
LblWat.Text = labels(3)

'this will crash if there are more than four "resource" elements
'you could also do

Dim allelements As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
Dim item As Integer = 0

For Each DD As HtmlElement In allelements

    If DD.OuterHtml.Contains("resource") Then

        TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))

        Select Case item
            Case 0: LblHel.Text = DD.GetAttribute("InnerText"))
            Case 1: LblIro.Text = DD.GetAttribute("InnerText"))
            Case 2: LblOxy.Text = DD.GetAttribute("InnerText"))
            Case 3: LblWat.Text = DD.GetAttribute("InnerText"))
        End Select

        item += 1

    End If

Next

'that would ignore any additional resource elements
This question has already been answered. Start a new discussion instead.