Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot access browser document under a timer
Message
De
03/04/2012 23:46:01
 
 
À
03/04/2012 23:13:52
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01540221
Message ID:
01540222
Vues:
30
Because of the threading, we have to use delegate. So, this goes like this:
    Private Function WebServiceMethod() As Boolean
        Dim loHtmlDocument As System.Windows.Forms.HtmlDocument = Nothing

        ' Initialization
        loHtmlDocument = GetHtmlDocument()

        loHtmlDocument.GetElementById("DivInner").InnerHtml = "Test"

        Return True
    End Function

    Private Delegate Function GetHtmlDocumentCallBack() As System.Windows.Forms.HtmlDocument

    ' This is needed to have safe cross-threading because of the timer
    Private Function GetHtmlDocument() As System.Windows.Forms.HtmlDocument

        ' If true
        If Log.InvokeRequired Then
            Return Log.Invoke(New GetHtmlDocumentCallBack(AddressOf GetHtmlDocument))
        Else
            Return Log.Document
        End If

    End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform