到目前为止,我是从OpenDialog教程和HTML编辑器/编写器教程中拼凑而成的,但是我今天才选择此内容,是为了完成此特定操作,因此我对VB和一般软件开发的先验知识非常低。 :P
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1 Click
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName > "" Then
WebBrowser1.DocumentText =
End sub
答案 0 :(得分:0)
使用WebBrowser Control的URL属性,也始终使用过滤器仅选择所需的格式
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.Filter = "Html or Pdf-Files(*.html; *.pdf))|*.html;*.pdf"
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim cfilenam As String = OpenFileDialog1.FileName()
If cfilenam.Trim().Length > 0 Then
Me.WebBrowser1.Url = New Uri(cfilenam)
Me.WebBrowser1.Refresh()
End If
End If
End Sub