I already have web pages written in HTML that give out Help info about various functions of the application.

How do I get them to pop up when the user clicks a button on the VB.NET form ?

Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHElp.Click


??


End Sub

Dani AI

Generated

Three practical options for a WinForms app that complement the replies already here: open the HTML in the user's default browser (external), show it inside the application with a WebBrowser control (in-app), or use the Windows help API for CHM/structured help. 's JavaScript popup is for web apps (ASP.NET/browser) and not applicable to a desktop button event. 's Process.Start approach works but launching "IExplore.exe" forces Internet Explorer; letting the OS pick the registered handler is safer. 's WebBrowser form is a good in-app solution if the help should remain part of the UI.

Open in the default browser (recommended when the help can be external and editing should be easy):

Dim helpFile = IO.Path.Combine(Application.StartupPath, "help", "GettingStarted.htm")
Process.Start(New ProcessStartInfo(helpFile) With {.UseShellExecute = True})

Keep help files in a "help" folder next to the executable and build paths with Path.Combine rather than hardcoding absolute locations.

Embed inside the app with a WebBrowser form (good for modal help windows and single-window UX):

Dim helpPath = IO.Path.Combine(Application.StartupPath, "help", "GettingStarted.htm")
Dim url = New Uri(helpPath).AbsoluteUri
Using f As New HelpForm()
    f.WebBrowser1.Navigate(url)
    f.ShowDialog()
End Using

Notes: the WebBrowser control uses the system's Internet Explorer engine and might render legacy HTML/CSS. For modern pages consider WebView2. For integrated Windows help (.chm) use the Help API:

Help.ShowHelp(Me, IO.Path.Combine(Application.StartupPath, "help", "UserGuide.chm"))

Troubleshooting and deployment tips: mark help files as data in ClickOnce or include them in the installer; avoid absolute paths; if help is embedded, write the resource to a temp file before navigating; some CHM files must be "unblocked" after download on newer Windows; and editing the WebBrowser emulation behavior requires registry changes (admin) — switch to WebView2 when possible for modern rendering.

Recommended Answers

All 4 Replies

do u mean,
clickin on button-it should perform the action as well as open popup window then..
sub btn_click(sender,obj)
Dim popupScript1 As String = "<script language='javascript'>" & _
window.open('PopUp.aspx', 'CustomPopUp', " & _
' "'width=500, height=500, menubar=yes,resizable=yes')" & _
' "</script>"
'Page.RegisterStartupScript("PopupScript", popupScript1)

I managed to do something like this in the meantime >>


Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem11.Click

Try
Process.Start("IExplore.exe", "C:/....../bin/GettingStarted.htm")
Catch
MsgBox("Error launching Internet Explorer")
End Try


End Sub

I use another form with a webbrowser on it. On the form I have a property:

Public WriteOnly Property HelpFile()
        Set(ByVal value)
            Me.WebBrowser1.Navigate(value)
        End Set
    End Property

In the button or menu click event I put the path and file I want to show.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.HelpFile = "d:\mywebs\vbnet.html"
        Form2.ShowDialog()
    End Sub

Hope this help some.

commented: The only sense amongst the other nonsense! +12

Aha :)

Thanks a lot for the help !!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.