Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
Dim ofd As New OpenFileDialog
ofd.Filter = "HTML-Files (*.html)|.html|HTM-Files (*.htm)|*.htm"
ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
Process.Start(ofd.FileName)
End If
End Sub
Hij werkt wel, maaar hij moet hem openen in MIJN webbrowser....Heb de oplossing voor jou probleempje:
Code:Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click Dim ofd As New OpenFileDialog ofd.Filter = "HTML-Files (*.html)|.html|HTM-Files (*.htm)|*.htm" ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then Process.Start(ofd.FileName) End If End Sub
Ik wil met een OpenFileDialog een html pagina laten openen in een webbrowser
Dim ofd As New OpenFileDialog
ofd.Filter = "HTML-Files (*.html)|.html|HTM-Files (*.htm)|*.htm"
ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim adres As New Uri(ofd.FileName)
webBrowser.Url = adres 'Dit is een standaard webbrowser die in de toolbox zit
End If
Je zei voor 'een' webbrowser, dus dacht ik aan IE of FF,
maar geen enkel probleem, hier heb je al de code voor UW webbrowser
Code:Dim ofd As New OpenFileDialog ofd.Filter = "HTML-Files (*.html)|.html|HTM-Files (*.htm)|*.htm" ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim adres As New Uri(ofd.FileName) webBrowser.Url = adres 'Dit is een standaard webbrowser die in de toolbox zit End If
Dim client As New System.Net.WebClient
Dim sfd As New SaveFileDialog
sfd.Filter = "All Files (*.*)|*.*"
sfd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
sfd.FileName = "index.html"
If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
client.DownloadFile(webBrowser.Url, sfd.FileName)
End If
Maar natuurlijk:
Code:Dim client As New System.Net.WebClient Dim sfd As New SaveFileDialog sfd.Filter = "All Files (*.*)|*.*" sfd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments sfd.FileName = "index.html" If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then client.DownloadFile(webBrowser.Url, sfd.FileName) End If
Als je nog iets moet weten, vraag maar raak!![]()
webBrowser.Print()
Weet je ook zeer toevallig hoe je het icoon van de site in de adresbalk laadAlsjeblieft!
Code:webBrowser.Print()
comboboxwelke control gebruik je als adresbalk?
ik bedoel eigenlijk gewoon een icoon en de URL zoals bij internet explorer... zoiets wil ik...hoe krijg je daar dan tekst en icon in ??![]()
Dim client As New System.Net.WebClient
Dim bytes() As Byte = client.DownloadData(WebBrowser.Url.AbsoluteUri & "favicon.ico")
Dim img As System.Drawing.Image
My.Computer.FileSystem.WriteAllBytes(Application.StartupPath & "\favicon.ico", bytes, False)
img = Image.FromFile(Application.StartupPath & "\favicon.ico")
'Je kan bvb 'img' laten tonen in een panel of picturebox
waar moet ik dat dan plaatsen en wat moet ik veranderen?Dat weet ik, maar het is nogal moeilijk om zoals bij internet explorer tekst EN icon
in de adresbalk te krijgen. Framework 2.0 ondersteunt dit nu eenmaal niet. Ik zal je
dan enkel maar de code geven hoe het icon te download van de site, je kan er dan
nog mee doen wat je wilt.
Code:Dim client As New System.Net.WebClient Dim bytes() As Byte = client.DownloadData(WebBrowser.Url.AbsoluteUri & "favicon.ico") Dim img As System.Drawing.Image My.Computer.FileSystem.WriteAllBytes(Application.StartupPath & "\favicon.ico", bytes, False) img = Image.FromFile(Application.StartupPath & "\favicon.ico") 'Je kan bvb 'img' laten tonen in een panel of picturebox
Private Sub WebBrowser_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser.ProgressChanged
If Not WebBrowser.IsBusy Then
Dim bytes() As Byte = client.DownloadData(WebBrowser.Url.AbsoluteUri & "favicon.ico")
Dim img As System.Drawing.Image
My.Computer.FileSystem.WriteAllBytes(Application.StartupPath & "\favicon.ico", bytes, False)
img = Image.FromFile(Application.StartupPath & "\favicon.ico")
'Je kan bvb 'img' laten tonen in een panel of picturebox
End If
End Sub
hij zegd dat "client" fout isIn de ProgressChanged Event van de webbrowser:
Code:Private Sub WebBrowser_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser.ProgressChanged If Not WebBrowser.IsBusy Then Dim bytes() As Byte = client.DownloadData(WebBrowser.Url.AbsoluteUri & "favicon.ico") Dim img As System.Drawing.Image My.Computer.FileSystem.WriteAllBytes(Application.StartupPath & "\favicon.ico", bytes, False) img = Image.FromFile(Application.StartupPath & "\favicon.ico") 'Je kan bvb 'img' laten tonen in een panel of picturebox End If End Sub
Dim client As New System.Net.WebClient
Sorry, mijn fout ... je moet nog in die subroutine toevoegen:
Code:Dim client As New System.Net.WebClient
wat moet ik veranderen aan de code, omdat ik nergens dat logo zie...
Private Sub WebBrowser_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser.ProgressChanged
If Not WebBrowser.IsBusy Then
[COLOR="Red"]Dim client As New System.Net.WebClient[/COLOR]
Dim bytes() As Byte = client.DownloadData(WebBrowser.Url.AbsoluteUri & "favicon.ico")
Dim img As System.Drawing.Image
My.Computer.FileSystem.WriteAllBytes(Application.StartupPath & "\favicon.ico", bytes, False)
img = Image.FromFile(Application.StartupPath & "\favicon.ico")
'Je kan bvb 'img' laten tonen in een panel of picturebox
End If
End Sub
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.