Help_File in C#

308 views Asked by At

I'm using MS Visual Studio Pro 2012 and I want to create some kind of help file.

I was thinking in create a html file like this but my question is: Do I need to have the html file always in this directory, even after I have the .EXE file created or the html file is added to the .EXE file?

If not, how can it be done?

[.NET Framework 4.5 | Windows Forms]

EDIT : I want to load a given (local) html file in the default web browser. This file should be 'inside' the .EXE file.

4

There are 4 answers

2
Mister Epic On

If you're looking to build a help file from Visual Studio, why not look at:

http://shfb.codeplex.com/

Sandcastle will build your help file based on the comments you have written on your classes and methods. Hit the forward slash three times (e.g. /) above your class or method declaration and the comment box will appear. Populate with salient details, run Sandcastle, and your help file will be generated.

7
keyboardP On

The advantage of having a separate HTML file is that you can update it on it's own without pushing out a new assembly. However if you want to build it into the EXE, you can go to your project properties, then click on Resources. Add an existing file (your HTML file) and it will now be accessible from your code.

When you want to open it you can do something like this

string html = Resources.MyHelpFile;
if (!File.Exists("tmpHelp.html"))
{
   using (var tmpFile = File.CreateText("tmpHelp.html"))
   {
      tmpFile.Write(html);
   }
}

Process.Start("tmpHelp.html");

You can then delete the help file at a later stage such as when the user closes your application.

0
AudioBubble On

I'll recommend using HTML Help Workshop to create the help file. and then use Help.ShowHelp();. Its a lot more easier

But for your case. You can either do as KeyboardP suggested or move the file to your bin/Debug folder and then use

    Process.Start("helpname.html");

NOTE : You'll also need to add the file to the Application Folder when you're creating your setup.

0
AsfK On

You can build html file (I think the most easy way it's to create it via microsoft word and to save as html) Then you make a new form contain webBrowser tool and set the URL to your html file path, like this:

string filepath = Environment.CurrentDirectory + @"\Help.htm";
Uri uri = new Uri(filepath);
webBrowser_Help.Navigate(uri);