1. Place this code inside your sub-menu (when clicked under main menu or button if you choose it instead). Make sure you follow the syntax below:
Help.ShowHelp(Me, [url]);
- Since you use VB as programming language, it should be 'Me' not 'this' because ‘this’ is for C#. By the way, what does it mean is ‘Me’ is your main form which will become the parent of the newly opened help file (in your case, your pdf file).
- Next parameter is ‘url’. In this type of parameter, it requires you to input the whole directory together with your pdf file.. For example, your help file is sample.pdf located at 'c:\program files\system'. Just add sample.pdf at the end of 'c:\program files\system' which becomes 'c:\program files\system\sample.pdf'.
So the final output of your ShowHelp() method is:
Help.ShowHelp(Me, "c:\program files\system\sample.pdf");
But there is one problem on this method if you install it in your client's computer; there is a possibility that his/her computer’s directories are different from yours. So if that's the case, follow this:
1. Place your sample.pdf file inside your project's bin-->debug folder (and bin-->release folder if there is) found in your project folder.
2. Then change your code into this
Help.ShowHelp(Me, Path.GetFullPath("sample.pdf"))
For example this is your whole code
--> You need to import System.IO at the top of your code, like this
Imports System.IO
NOTICE:
- This tutorial will work only in Microsoft Visual Studio esp. 2008 (not sure in 2003 and 2005 because I used Path class which I don’t know if existing in .NET 1.1 and .NET 2.0). 2008 uses .NET 3.5.
- I notice that chm, doc and pdf files will open once after clicking the button or submenu under main menu while txt will open as many times you click it.
Hope that helps! =) Always here to post useful tutorials for you guys!