Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot access browser document under a timer
Message
From
03/04/2012 23:46:01
 
 
To
03/04/2012 23:13:52
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01540221
Message ID:
01540222
Views:
29
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
Previous
Reply
Map
View

Click here to load this message in the networking platform