Imports System.IO
Imports System.Windows.Forms
Public Class frmAide

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call setupBrowser2()
    End Sub
    Private Sub setupBrowser2()
        ' This prevents the Web browser from opening files that are dropped onto it.
        WebBrowser1.AllowWebBrowserDrop = False

        Dim toto As String = "NoAide.mht"
        Select Case Aff.FichierAide
            Case 1
                toto = "Pieu_Categorie.mht"
            Case 2
                toto = "Pieu_Dim_Forage.mht"
            Case 3
                toto = "Pieu_Cotes.mht"
            Case 4
                toto = "Pieu_Categorie17_18.mht"
            Case 5
                toto = "Pieu_Niveau_Eau.mht"
            Case 6
                toto = "Pieu_Sol_ValeursCaracteristiques.mht"
            Case 7
                toto = "Pieu_Cone_Jupe.mht"
            Case 8
                toto = "Pieu_Sol_Penetrometre.mht"
            Case 9
                toto = "Pieu_Tassement.mht"
            Case 10
                toto = "Pieu_Abbattement50%.mht"
            Case 11
                toto = "Pieu_EffetdeGroupe.mht"
            Case 12
                toto = "Pieu_Abbattement30%.mht"
            Case 13
                toto = "Pieu_ResistancePointe.mht"
        End Select
        Dim fi As New FileInfo(Directory.GetCurrentDirectory.ToString() & "\Aide\" & toto)
        DisplayHTMLDoc(fi.FullName)
    End Sub

    Private Sub DisplayHTMLDoc(ByVal path As String)
        If Not path = String.Empty Then
            Try
                If (File.Exists(path)) Then
                    WebBrowser1.Url = New Uri(path)
                Else
                    MessageBox.Show("Désolé, fichier d'aide introuvable à l'adresse suivante: " & path & ".", "Fichier d'aide", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    Me.Close()
                End If
            Catch ex As ApplicationException
                MessageBox.Show("L'erreur suivante s'est produite lors de l'accès au fichier d'aide: " + ex.Message & ex.StackTrace, "Fichier d'aide", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End Try
        End If
    End Sub
End Class