Question A little help with frames

PureBrit

New member
Joined
Jun 4, 2010
Messages
1
Programming Experience
Beginner
Im trying to make a frame on a website refresh with a new src.

This is my function in a seperate module
PHP:
    Public Function StatusRead()

        If Form1.WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
            Dim theStatusCollection As HtmlElementCollection = Form1.WebBrowser1.Document.GetElementsByTagName("frame")
            For Each curElement As HtmlElement In theStatusCollection
                Dim controlName As String = curElement.GetAttribute("id").ToString
                If controlName = "main" Then
                    curElement.GetAttribute("scr").Equals("./BeO/webroot/index.php?module=Launchpad")
                    If Form1.myFlag = False Then
                        Form1.myFlag = True
                        Dim FrameToRefresh = Form1.WebBrowser1.Document.Window.Frames(1)
                        FrameToRefresh.Open(FrameToRefresh.Url, "_self", "", True)
                    End If
                End If
            Next
        End If
        Return 0
    End Function

This is my Form1
PHP:
Public Class Form1
    Public myFlag As Boolean = False

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("http://www.barafranca.com/game-login.php")
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        Login()
        StatusRead()
    End Sub
End Class

The flag is declared at class level in my form1.vb and the reason for the flag is to stop the frame endlessly refreshing
 
Move the StatusRead to form class, where you also refer to Me.WebBrowser1 and Me.myflag. Otherwise HtmlWindow.Open appears to work, you can also use the frame HtmlElement and SetAttribute src.
 
Back
Top