(07-08-20, 05:21 AM)عبد العزيز البسكري كتب :أخي الكريم ..ضع لنا مثالا صغيرا للكود المستعمل خلال الطباعة لنفكّر معك لعلنا نجد الحل إن شاء الله .. تحياتي
كود :
Try
'كود الطباعة
Application.DoEvents()
ProgressBar1.Visible = True
Dim rpt As New Repor : ProgressBar1.Value = 10
rpt.SetDataSource(DataSet1) : ProgressBar1.Value = 40
Form1.ReportViewer1.ReportSource = rpt : ProgressBar1.Value = 60
'كلمة سر قاعدة البيانات
Form1.ReportViewer1.LogOnInfo(0).ConnectionInfo.Password = "optimize" : ProgressBar1.Value = 100
ProgressBar1.Visible = False
'اختيار طابعة اخرى للطباعة غير الطابعة الافتراضية
rpt.PrintOptions.PrinterName = "اسم الطابعة الخاصة الاخرى"
'معاينة التقرير
Form1.ShowDialog()
'كود طباعة مع ظهور نافذة الطباعة
Form1.ReportViewer1.PrintReport()
'كود طباعة مباشرة مع تحديد عد النسخ
rpt.PrintToPrinter(1, True, 0, 0)
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try