Salve, sto sviluppano un programma..

se faccio:

codice:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'INIZIO CONTROLLI
        If TextBox1.Text = "" Then
            MessageBox.Show("Errore N. 1")
            Exit Sub
        End If

        If Not IsNumeric(TextBox1.Text) Then
            MessageBox.Show("Errore N. 2")
            Exit Sub
        End If

        If TextBox2.Text = "" Then
            MessageBox.Show("Errore N. 3")
            Exit Sub
        End If

        If Not IsNumeric(TextBox2.Text) Then
            MessageBox.Show("Errore N. 4")
            Exit Sub
        End If

        If TextBox3.Text = "" Then
            MessageBox.Show("Errore N. 5")
            Exit Sub
        End If

        If Not IsNumeric(TextBox3.Text) Then
            MessageBox.Show("Errore N. 6")
            Exit Sub
        End If

        id = TextBox1.Text
        offerta_max = TextBox2.Text
        tempo = TextBox3.Text



        'INIZIO ATTIVAZIONE
        WebBrowser1.Navigate("http://***.it/" & id)


        If prezzo_ora > offerta_max Then
            MessageBox.Show("Errore N. 7")
            Exit Sub
        End If

        'ATTIVO TIMER SE TUTTO CORRETTO
        Timer1.Enabled = True


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim html As String
        Dim posizione As String
        Dim i As Integer

        'Prelevo HTML
        html = WebBrowser1.DocumentText

        'Cerco la posizione approssimata
        posizione = InStr(html, "<span id=""v4-26"" class=""")

        'Scansione precisa
        For i = posizione To html.Length
            If html.Substring(i, 4) = "EUR " Or html.Substring(i, 4) = "US $" Then
                i += 4
                For j = i To html.Length
                    If html.Substring(j, 1) = "<" Then
                        prezzo_ora = html.Substring(i, j - i)
                        Exit For
                    End If
                Next
                Exit For
            End If
        Next
    End Sub
IN QUEL MODO FUNZIONA SE INVECE CREO UNA FUNZIONE AL POSTO BUTTON2 MI DICE:
Index e length devono fare riferimento a una posizione nella stringa. Nome parametro: length
sulla riga
codice:
            If html.Substring(i, 4) = "EUR " Or html.Substring(i, 4) = "US $" Then
Ho sbattuto troppo la testa ma non riesco a capire.. qualcuo che mi aiuta?