1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| ' fonction d'exécution d'un etat crystal report, prend en paramètre le nom de l'état, sa formule de sélection, le titre de la fenetre où s'affiche l'état et un booléen pour afficher ou pas l'arborescence de groupe
Public Shared Sub Exec_Rapport(ByVal Nom_Rapport As String, ByVal Formule_Selection As String, ByVal Titre_Fenetre As String, ByVal Montrer_Arbre As Boolean)
Dim frm As New Fiche_Impression()
frm.MdiParent = Form.ActiveForm
Dim i As Integer = 0
Dim Res As Integer = 0
frm.CrystalReportViewer1.ReportSource = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\Etats\" & Nom_Rapport
Try
For i = 0 To frm.CrystalReportViewer1.LogOnInfo.Count() - 1 Step 1
frm.CrystalReportViewer1.LogOnInfo.Item(i).ConnectionInfo.ServerName = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\Pieces_CPLF.mdb"
frm.CrystalReportViewer1.LogOnInfo.Item(i).ConnectionInfo.UserID = "Admin"
Next
frm.CrystalReportViewer1.SelectionFormula = Formule_Selection
frm.CrystalReportViewer1.DisplayGroupTree = Montrer_Arbre
frm.CrystalReportViewer1.Refresh()
frm.CrystalReportViewer1.ShowFirstPage()
frm.Text = Titre_Fenetre
frm.Visible = True
Catch ex As Exception
Res = MsgBox("Erreur lors du chargement du rapport " & Nom_Rapport & " : " & ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Gestion du Stock")
End Try
End Sub |
Partager