Click here to Skip to main content
12,700,567 members (32,788 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

3.7K views
2 bookmarked
Posted

HelpButton: A Button Linked to a Topic of a chm Help File

, 8 Mar 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
May be this will help instead of writing the path all the time:private void showHelp() { string dirpath = string.Empty; //string filename = "ACHWINAPP.chm"; dirpath = System.Environment.CurrentDirectory; string[] files = new...
May be this will help instead of writing the path all the time:

private void showHelp()
        {
            string dirpath = string.Empty;
            //string filename = "ACHWINAPP.chm";
            dirpath = System.Environment.CurrentDirectory;
            string[] files = new string[100];
            do
            {
                if (dirpath == string.Empty || dirpath == Directory.GetDirectoryRoot(dirpath))
                {
                    MessageBox.Show("no helpfile found");
                }
                else
                {
                    files = Directory.GetDirectories(dirpath, "ACH");
                    if (files.Length > 0)
                    {
                        //MessageBox.Show(files[0]);
                        string strHlp = string.Empty;
                        strHlp = files[0] + "\\ACHWINAPP.chm";
                        Help.ShowHelp(this, strHlp);
                        break;
                    }
                    else
                    {
                        dirpath = Directory.GetParent(dirpath).ToString();
                    }
                }
            } while (true);
        }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

demouser743
Software Developer
India India
I am working as a Software engineer. Web development in Asp.Net with C#, WinForms and MS sql server are the experience tools that I have had for the past 3 years. Yet to work on WCF, WPF, Silverlight and other latest ones.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralWhat ever file name it is he has to give the name there i ju... Pin
Dorababu74314-Mar-11 0:05
memberDorababu74314-Mar-11 0:05 
GeneralReason for my vote of 1 Explained in my comments. Pin
Olivier Levrey8-Mar-11 2:48
memberOlivier Levrey8-Mar-11 2:48 
General1- Using <CODE>CurrentDirectory</code> is not recommanded si... Pin
Olivier Levrey8-Mar-11 2:47
memberOlivier Levrey8-Mar-11 2:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 8 Mar 2011
Article Copyright 2011 by demouser743
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid