473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to open a help file (.chm)

23
Hi, I'm new on this website as you may already know. I've created a nifty calculation program (not a calculator, a simultaneous equation solver). I've also created a help file named 'help.chm'. I'm trying to make a menu item open it without having a dialog box come up, but I don't know how to do that, so can anyone help me please.
I'm new to VB so i'm not so good at it right now.
Jun 27 '06 #1
4 17767
Hemant Pathak
92 Expert
Hi str1ker
Go to the project properties there u see the option of Help File Name here u write ur .chm file Name. its enough.

Run ur software and when u press F1 key then ur Help file is excuted.
Aug 21 '06 #2
liamus
1
I like the sound of this program, hope it works!
to launch i would use:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.F1
Process.Start(System.IO.Path.Combine(Application.S tartupPath, "help.chm"))
End Select
End If
End Sub

this assigns it to run when the user presses F1.
Jan 6 '08 #3
For Visual Basic 2005 users, this might help you a little better..

The first sub routine opens the help file if a toolbar menu item is clicked, and the second opens the help file when the HelpRequested button (F1) is pressed on that form.

Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click

Process.Start(My.Application.Info.DirectoryPath & "\MyHelp.chm")

End Sub

Private Sub MyFormName_HelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) Handles Me.HelpRequested

Process.Start(My.Application.Info.DirectoryPath & "\MyHelp.chm")

End Sub
Jun 25 '08 #4
It should be noted that there is a better way to implement a CHM Help file into your VB 2005 application.

The easy way;
1.) Simply add your existing CHM file to your Project and set it to Copy Always or Copy If Newer.

2.) On your form, drag and drop in a HelpProvider from the Components Toolbox.

3.) In your Form Properties, adjust the setting "HelpButton" to TRUE and adjust the setting "HelpNavigator on HelpProvider1" to TableOfContents.

4.) Adjust the "HelpNameSpace" of the HelpProivder1 component to the name of your CHM file. ie. MyHelpFile.chm

Done.

You can also optionally set the "HelpString" or "HelpKeyword" properties of your form, which enable you to send your user to a specific spot in your CHM, assuming you've built it correctly.

When a user presses F1 the CHM opens. This method also prevents the user from opening multiple copies of the same help document.

To create your CHM, I recommend the antiquainted but well suited HTML Help Workshop by Microsoft. It's old, but works like a champ. Besides, the real gloss of your help file is the HTML/CSS, not the program you used to compile a CHM anyway.

The method mentioned in the previous post, while it works, would also require you capture the EventHandler of the process and track when the process exited.

However, if you insist on doing it the hard way, here's some bonus junk;


Public WithEvents p As Process '-- Help File Process Handler
Public IsMyHelpFileOpen As Boolean = False '-- Store Current State of Help File

Public Function OpenHelp(ByVal CurrentState As Boolean) As Boolean

'-- Open the help CHM file. If already open, close it, and reopen it.
'-- Incredible Mouse

Try

If CurrentState = True Then
p.CloseMainWindow()
Else
p = New Process()
End If

' Handle the Exited event that the Process class fires.
AddHandler p.Exited, AddressOf p_Exited
p.EnableRaisingEvents = True
p.SynchronizingObject = Me
p.StartInfo.FileName = My.Application.Info.DirectoryPath & "\MyHelpFileName.chm"
p.Start()
IsMyHelpFileOpen = True
OpenHelp = True

Catch ex As Exception

OpenHelp = False

'--Write to the event log.
Dim sEvent As String
sEvent = My.Resources.HelpFileFailure
If Not EventLog.SourceExists(sSource, sMachine) Then
EventLog.CreateEventSource(mySourceData)
End If
Dim ELog As New EventLog(sLog, sMachine, sSource)
ELog.WriteEntry(sEvent, EventLogEntryType.Warning, 2001, CType(1, Short))

MsgBox("Error: " & Err.Description, MsgBoxStyle.Exclamation, "Error Encountered")
Exit Function

End Try

End Function

Private Sub p_Exited(ByVal sender As Object, ByVal e As System.EventArgs)

'-- When the CHM file is closed, this returns a false to the public variable IsMyHelpFileOpen.

IsMyHelpFileOpen = False

End Sub
Jun 25 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: davidwelch40 | last post by:
Hi, Can someone please tell me how to open a help file through forms. I have tried the HOST() command which was detailed in a previous topic however i get the message 'This is not a windows help...
0
by: Rob Y | last post by:
I'm building a very small vb.net winforms application and I've created a compiled help file (.chm) with HTML Help Workshop. I added the chm file to the project by selecting Add > Existing Item. ...
3
by: Sushil Prasad | last post by:
I am having problem in displaying the compiled help file. In asp.net app I have link button laballed help. On the users click of this button i do the respose.redirect to the url of the .chm file....
6
by: Sushil Prasad | last post by:
I am having problem in displaying the compiled help file. In asp.net app I have link button labeled help. On the users click of this button i do the respose.redirect to the url of the .chm file....
0
by: Chris Dunaway | last post by:
I have a help file (.chm extension) and I want to show it. I know I can use the Process class to start the .chm file and it will appear, but I want it to be contained within my form. For example,...
5
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
0
by: KG | last post by:
Hi, In our windows form when user press F1 for help we want our help file to open through silent deployment. But when it open it opens a dialog window to save it or open it or cancel it. When we...
1
by: Lars Netzel | last post by:
I want to create a userhelp for a program i've built.. but how do I create a Helpfile like the standards in Microsoft environment? /Lars
6
by: Paul Aspinall | last post by:
Hi I'm trying to get opinions on the best free / best value help file (CHM) compilers out there. What do you use? Thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.