我正在使用特殊程序加载一些网址想象它像窗口一样自动加载www.google.com - 程序启动并加载网站 - 但是当你点击程序窗口中的某些链接时它会在默认浏览器中打开 - 如何在默认浏览器中打开它 - 我正在使用此代码:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.WB = New System.Windows.Forms.WebBrowser
.....
.....
Me.WB.Url = New System.Uri("http://www.google.com/", System.UriKind.Absolute)
使用Visual Basic 2008
答案 0 :(得分:0)
如果我正确理解了您的问题(如果我错了,请告诉我),您询问如何在特定网址上打开系统默认浏览器。这可以这样实现:
Process.Start("http://www.example.com/")
如果路径存储在Uri
对象中,则需要使用其ToString()
方法:
Process.Start(someUri.ToString())