Ciao,so che è passato un mese dalla pubblicazione della discussione del forum,ma se non hai risolto ancora il problema,ti posso aiutare.
Ora ti mando i codici:
codice:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Try
Label3.Visible = True
Label3.Text = WebBrowser1.Document.All("last_last").InnerText
Dim mioelemento As HtmlElementCollection = WebBrowser1.Document.All
For Each miapaginaweb As HtmlElement In mioelemento
If miapaginaweb.GetAttribute("itemprop") = "name" Then
Me.Text = miapaginaweb.InnerText
Label1.Visible = True
Label1.Text = miapaginaweb.InnerText
End If
If miapaginaweb.GetAttribute("dir") = "ltr" Then
Label5.Visible = True
Label5.Text = miapaginaweb.InnerText
If Label5.Text.Contains("+") Then
Label5.ForeColor = Color.Green
Else
Label5.ForeColor = Color.Red
End If
WebBrowser2.Navigate("http://it.investing.com/equities/ubi-banca")
End If
Next
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.ScriptErrorsSuppressed = True
WebBrowser2.ScriptErrorsSuppressed = True
Label2.Visible = True
End Sub
Private Sub WebBrowser2_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
Try
Dim mioelemento2 As HtmlElementCollection = WebBrowser2.Document.All
For Each miapaginaweb2 As HtmlElement In mioelemento2
If miapaginaweb2.GetAttribute("dir") = "ltr" Then
Label4.Text = miapaginaweb2.InnerText
If Label4.Text.Contains("+") Then
Label4.ForeColor = Color.Green
Else
Label4.ForeColor = Color.Red
End If
If Label4.Text.StartsWith("+") Then
Panel1.Visible = False
Label4.Visible = True
Timer1.Start()
Exit Sub
End If
End If
Next
Catch ex As Exception
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
My.Settings.Timer += 1
If My.Settings.Timer = 10 Then
Timer1.Stop()
My.Settings.Timer = "0"
WebBrowser1.Refresh()
Panel1.Visible = True
End If
End Sub
Se vuoi poi ti posso mandare il programma che io ho creato,almeno hai un'aiuto in più.
Attenzione però invece di utilizzare le textbox,ho usato le label. Ma non preoccuparti basta rimuovere le label e configurare le textbox è un lavoro facilissimo.
Siccome c'è un problema con il sito web,ho utilizzato 2 web browser e in più la panel con il timer che indicano l'aggiornamento ogni 10 secondi. Dentro la panel c'è una label dove è scritto "IN AGGIORNAMENTO". Poi ti ricordo che se vuoi ridurre i tempi a 5 seconfi basta fare cosi:
codice:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
My.Settings.Timer += 1
If My.Settings.Timer = 5 Then
Timer1.Stop()
My.Settings.Timer = "0"
WebBrowser1.Refresh()
Panel1.Visible = True
End If
Spero di esserti stato d'aiuto.Ciao.