Buongiorno,
ho creato questa routine per leggere, all'interno di una pagina web, l'indirizzo di uno specifico link, ho scritto il seguente codice con Visual Studio community 2019:
Private Sub TSBImportaMonografia()
        Static wb As WebBrowser, readText As String()
        Dim dgv As DataGridView = ElencoTAFDataGridView
        Dim selectedRowCount As Integer = dgv.Rows.GetRowCount(DataGridViewElementStates.Selected)
        If selectedRowCount = 1 Then
            If IsNothing(wb) Then
                wb = New WebBrowser
                AddHandler wb.DocumentCompleted, AddressOf Wb_DocumentCompleted
            End If
            If IsNothing(readText) Then
                readText = File.ReadAllLines(dirApplicationData & "\Preferenze.tfm")
            End If
            Dim comune As String = ComuneToolStripComboBox.ComboBox.SelectedItem(1).ToString.ToUpper
            Dim firstSlashPos As Integer = comune.IndexOf(" ")
            If firstSlashPos > 0 Then comune = comune.Substring(0, firstSlashPos)
            Dim rigaSelez As Integer = dgv.CurrentRow.Index
            Dim codComune As String = dgv.Rows(rigaSelez).Cells(0).Value.ToString.Substring(0, 4)
            Dim foglioFile As String = dgv.Rows(rigaSelez).Cells(1).Value.ToString
            Dim linkM As String = String.Format("{0}{1}&comune={2}&co={3}&foglio={4}",
                        readText(6),
                        Replace(ProvincieToolStripComboBox.ComboBox.SelectedItem(1), "'", ""),
                        comune,
                        codComune,
                        Integer.Parse(foglioFile.ToString.Substring(0, 3)))
            wb.Navigate(linkM, False)
        Else
            MessageBox.Show("Non è stato selezionato nessun punto fiduciale (max 1)", "Download monografia PF", MessageBoxButtons.OK)
        End If
    End Sub
il valore della variabile linkM, per esempio, è: https://www1.agenziaentrate.gov.it/servizi/Monografie/risultato.php?provincia=ORISTANO&comune=ABBASANTA&co=A007&foglio=4
L'errore si verifica sulla riga:  wb.Navigate(linkM, False)

Cliccando sul tasto Si prosegue con il Sub sotto e completa la procedura senza problemi, ma non capisco dov'è l'errore di sintassi. Tengo a precisare che questo errore si è verificato da qualche giorno, prima funzionava perfettamente.
   Private Sub Wb_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs)
        Static readText As String()
        If IsNothing(readText) Then
            readText = File.ReadAllLines(dirApplicationData & "\Preferenze.tfm")
        End If
        Dim cartMono As String = readText(16)
        Dim wb As WebBrowser = DirectCast(sender, WebBrowser)
        Dim dgv As DataGridView = ElencoTAFDataGridView
        Dim rigaSelez As Integer = dgv.CurrentRow.Index
        Dim codComune As String = dgv.Rows(rigaSelez).Cells(0).Value.ToString
        Dim foglioFile As String = dgv.Rows(rigaSelez).Cells(1).Value.ToString
        Dim numPF As String = dgv.Rows(rigaSelez).Cells(2).Value.ToString.Substring(2, 2)
        Dim filePF As String = codComune & "-" & foglioFile & "-" & numPF
        Dim comune As String = ComuneToolStripComboBox.ComboBox.SelectedItem(1)
        Dim noMono As Boolean = True
        For Each he As HtmlElement In wb.Document.Links
            Dim linkMonografia As String = he.GetAttribute("href")
            If linkMonografia.Contains("namefile=" & filePF) Then
                noMono = False ' no mono
                Using SFD As New SaveFileDialog
                    With SFD
                        .Title = "Salvataggio monografia PF" & numPF & "/" & foglioFile & "/" & codComune
                        .DefaultExt = "PDF"
                        .AddExtension = True
                        .InitialDirectory = cartMono
                        .Filter = "file pdf|*.pdf"
                        .FileName = codComune & "-" & foglioFile & "-" & numPF
                        .OverwritePrompt = True
                        If Not .ShowDialog = Windows.Forms.DialogResult.OK Then Exit For
                        Try
                            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
                            My.Computer.Network.DownloadFile(linkMonografia, .FileName, "", "", False, 25000, True)
                            Process.Start(.FileName)
                            Exit For
                        Catch ex As Exception
                            Dim msgBoxResult = MsgBox(ex.Message, MsgBoxStyle.RetryCancel)
                            'Exit For
                            TSBImportaMonografia()
                        End Try
                    End With
                End Using
            End If
        Next
        If noMono Then
            If ComuneToolStripComboBox.ComboBox.SelectedItem(1) = "Intera provincia" Then
                MessageBox.Show("Il PF" & numPF & " del foglio " & foglioFile &
                                " del Comune con codice " & codComune & " è senza monografia",
                                "Download monografia PF", MessageBoxButtons.OK)
            Else
                MessageBox.Show("Il PF" & numPF & " del foglio " & foglioFile &
                                " del Comune di " & comune & " è senza monografia",
                                "Download monografia PF", MessageBoxButtons.OK)
            End If
        End If
    End Sub