Hi everybody, I want to make an async timer but I'm straggling a bit with thread safe.. I m not able not to call object from main thread. The code is this one:
There is a way where I can make this code run async? ThanksCode:Dim res As String Dim client As New WebClient() client.Encoding = Encoding.UTF8 client.Headers.Add(HttpRequestHeader.UserAgent, "") Dim stream = client.OpenRead("url link") Dim sr As StreamReader = New StreamReader(stream) BetterListBox1.Items.Clear() res = (sr.ReadToEnd) 'FILTRO I TAG HTML DAL CONTENUTO RAW ' Dim sourcestring As String = res Dim matchpattern As String = "<(?:[^>=]|='[^']*'|=""[^""]*""|=[^'""][^\s>]*)*>" Dim replacementstring As String = "" res = ((Regex.Replace(res, matchpattern, ""))) res = WebUtility.HtmlDecode(res) Dim visibleItems As Integer = CInt(BetterListBox1.ClientSize.Height / BetterListBox1.ItemHeight) BetterListBox1.Items.AddRange(Split(res, vbLf)) BetterListBox1.TopIndex = Math.Max(BetterListBox1.Items.Count - visibleItems + 1, 0) End Sub




Reply With Quote
