Post by alex on Aug 17, 2015 18:50:56 GMT 10
So Guys, I have now decided to add a awesomium browser inside the form, and I am using TWBp Tab Control as I was unable to understand what the admin was saying, as admin if possible please can you upload a video tutorial on creating custom tabs like AirBrowse? I know you will have to invest you precious time, but its a request. And my question is how to add favicon to my temporary tab control(TWBP, I have very high expectation from this website! ) to my awesomium webbrowser and display another image if there is no favicon present? Like: Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabTitle = WebControl1.Title
Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabIcon = What to write here? <-------- ?
The second is reloading problem When ever I reload Website like google or YouTube, not Yahoo.com the tab title keeps on saying Navigating..... Whats wrong with the code? Imports Awesomium.Core
Public Class NewTab
Private Sub NewTab_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebControl1.Source = New Uri(My.Settings.HomePage)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If WebControl1.CanGoBack Then
WebControl1.GoBack()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs)
If WebControl1.CanGoForward Then
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs)
WebControl1.Stop()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
If TextBox1.Text.Contains("a") Then
If TextBox1.Text.Contains("a") Then
Try
WebControl1.Source = New Uri(TextBox1.Text)
TextBox1.Text = WebControl1.Source.ToString()
Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabTitle = WebControl1.Title
Catch ex As System.UriFormatException
WebControl1.Source = New Uri("http://" + TextBox1.Text)
TextBox1.Text = WebControl1.Source.ToString()
Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabTitle = WebControl1.Title
End Try
End If
End If
End Sub
Private Sub WebControl1_LoadingFrame(sender As Object, e As LoadingFrameEventArgs) Handles WebControl1.LoadingFrame
Button3.Visible = False
Button4.Visible = True
TextBox1.Text = WebControl1.Source.ToString()
Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabTitle = WebControl1.Title
Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabIcon =
End Sub
Private Sub WebControl1_LoadingFrameComplete(sender As Object, e As FrameEventArgs) Handles WebControl1.LoadingFrameComplete
Button3.Visible = True
Button4.Visible = False
Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabTitle = WebControl1.Title
End Sub
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
If TextBox1.Text.Contains(TextBox1.Text) Then
Try
WebControl1.Source = New Uri(TextBox1.Text)
Catch ex As System.UriFormatException
WebControl1.Source = New Uri("http://" + TextBox1.Text)
End Try
End If
End If
End Sub
Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
WebControl1.Reload(ignoreCache:=True)
End Sub
Private Sub HomePageToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HomePageToolStripMenuItem.Click
Settings.Visible = True
End Sub
Private Sub Button4_Click_1(sender As Object, e As EventArgs) Handles Button4.Click
WebControl1.Stop()
End Sub
End Class
|
|
Post by ranilwallace on Aug 18, 2015 2:12:13 GMT 10
1. I use twbp so i could help you with the favicons: Private Sub WebControl_LoadingFrameComplete(ByVal sender As Object, ByVal e As Awesomium.Core.FrameEventArgs) Handles WebControl.LoadingFrameComplete getfavicon() End Sub Public Sub getfavicon() Try 'favicon Dim url = YOURWebControlNAME.Source Dim iconURL = "http://" & url.Host & "/favicon.ico" Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL) Dim response As System.Net.HttpWebResponse = request.GetResponse() Dim stream As System.IO.Stream = response.GetResponseStream() Dim favicon = Image.FromStream(stream) FORMWITHTABCONTROLNAME.TABCONTROLNAME.TabContainer.getTabFromForm(Me).TabIcon = favicon Catch ex As Exception LauveBrowser.browsertabs.TabContainer.getTabFromForm(Me).TabIcon = My.Resources.icon_16x16 End Try 2. For the navigating thing change the webcontrols navigationinfo property in the properties window to none. That should do it. If i helped you click solved!
Ranil, Lauve Tech
|
|
Post by Justin Lopez on Aug 18, 2015 6:29:54 GMT 10
ranilwallace Wow, thanks for helping alex. alex Mark this as solved if the answer above has helped you.
|
|
Post by ranilwallace on Aug 18, 2015 9:31:13 GMT 10
sure no problem
Ranil, Lauve Tech
|
|
Post by ranilwallace on Aug 19, 2015 2:42:47 GMT 10
Also put the favicon code in the loading complete sub
Ranil, Lauve Tech
|
|
Post by alex on Aug 19, 2015 3:16:25 GMT 10
Thank you!
|
|
Post by alex on Aug 19, 2015 4:32:16 GMT 10
Private Sub WebControl1_LoadingFrameComplete(sender As Object, e As FrameEventArgs) Handles WebControl1.LoadingFrameComplete Button3.Visible = True Button4.Visible = False Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabTitle = WebControl1.Title getfavicon() End Sub
Public Sub getfavicon() Try 'favicon Dim url = WebControl1.Source Dim iconURL = "http://" & url.Host & "/favicon.ico" Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL) Dim response As System.Net.HttpWebResponse = CType(request.GetResponse(), Net.HttpWebResponse) Dim stream As System.IO.Stream = response.GetResponseStream() Dim favicon = Image.FromStream(stream) Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabIcon = favicon Catch ex As Exception Form1.TwbpTabs1.TabContainer.getTabFromForm(Me).TabIcon = My.Resources.left1 End Try End Sub
Everything in bold is underlined red...
|
|
Post by efwwww on Aug 19, 2015 8:09:36 GMT 10
Well let's see.
I'm not too sure what could be the cause since this is only a short snippet. Personally, I think declaring the type of a variable would be better since it is easy to track what data type would be used. Having the datatype be determined at run time may be a little bit slower. Ex:
Dim url As String = WebControl1.Source
Other than that, I just tested the code (filling all the missing pieces myself) and it worked fine. Have you tried looking at the error message in VS? It would be better if you told us what errors were shown.
This may be a bit out there, but have you checked to see if some of the variables have been declared already?
|
|
Post by ranilwallace on Aug 19, 2015 8:21:11 GMT 10
What is the problem ?
Ranil, Lauve Tech
|
|
Post by alex on Aug 19, 2015 22:20:32 GMT 10
It says its not declared. Even after like a minute
|
|