Hi Guys,
I have a form (frmBrowser) with a Webview control on it, which I made in the designer.
Now, from a Class Module I first load that form, then I iterate through the controls on the form until I find the Webview (I look for a Tag of 'WebBrowser' which I gave it in the designer).
This is so that I can grab a reference to the Webview and then set it equal to an internal Webview variable in the class module.
I then set it's URL and respond to it's events from within my class module.
The problem I am having is that sometimes my code compiles with no errors, and other times it stops with an error of 'expected expression'
I have indicated with a comment below the line that causes the error.
All I am trying to do here is control a Webview I have on a form from within my Class Module so that I can set it's URL and respond to it's events from within my Class Module.
This is the code (from within my Class module)
Thank you very much in Advance!
Regards,
Jacques.
I have a form (frmBrowser) with a Webview control on it, which I made in the designer.
Now, from a Class Module I first load that form, then I iterate through the controls on the form until I find the Webview (I look for a Tag of 'WebBrowser' which I gave it in the designer).
This is so that I can grab a reference to the Webview and then set it equal to an internal Webview variable in the class module.
I then set it's URL and respond to it's events from within my class module.
The problem I am having is that sometimes my code compiles with no errors, and other times it stops with an error of 'expected expression'
I have indicated with a comment below the line that causes the error.
All I am trying to do here is control a Webview I have on a form from within my Class Module so that I can set it's URL and respond to it's events from within my Class Module.
This is the code (from within my Class module)
B4X:
Sub Class_Globals
Private WebBrowser As WebView
End Sub
Sub GetWebBrowserReference()
'Load my form containing the Web Browser
PageRoot_.RootPanel.LoadLayout("frmBrowser")
Sleep(0) 'Wait for form to finish loading, not sure if this is correct way of doing it??
'Now Look at each control on the form I just loaded in succession.....
For Each v As View In PageRoot_.RootPanel.GetAllViewsRecursive
'If I found a Webview.....
If GetType(v).Trim.ToLowerCase.Contains("webview") = True Then
'....if it Is the one I am looking For, ie. Tag = 'WebBrowser'
If v.Tag = "WebBrowser" Then
'Grab a reference To it.
WebBrowser = v '<<<<<< This line causes the compile error.
'Get out of the Loop.
Exit
End If
End If
Next
End Sub
Thank you very much in Advance!
Regards,
Jacques.