我想在单击VB.NET中的按钮时显示.CHM帮助文件.谁能告诉我代码怎么做? Private Sub cmdHelp_Click(ByVal sender As System.Objects, Byval e As System.EventArgs)Handles cmdHelp.Click 'Please help provide some codeEnd Sub 使
Private Sub cmdHelp_Click(ByVal sender As System.Objects, Byval e As System.EventArgs)Handles cmdHelp.Click 'Please help provide some code End Sub使用动词open打开Process.Start可以解决问题:
Module Module1 Sub Main() Dim p As New Process() Dim psi As New ProcessStartInfo("path to my CHM file") psi.Verb = "open" p.StartInfo = psi p.Start() Console.ReadKey() End Sub End Module
请注意.操作系统严格限制.chm文件从WinXP SP3(SP2?)开始 – 它们被认为是一个合理的安全风险,因此您无法直接从网络或远程位置打开它们.您需要相应地编码,并在尝试打开它们时期望例外.