none
How to Print Data grid view values from Printer with out print preview. RRS feed

  • Question

  • Hi (need code)

    I use crystal reports i want form , when i press print button, it print crystal report, instead of show data grid view values on report for print preview. 

    NOTE data grid view use database value

    thanks


    MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959


    Tuesday, March 26, 2019 3:29 PM

All replies

  • Hi

    Thank you for repairing your CAPS LOCK key.


    Regards Les, Livingston, Scotland

    Tuesday, March 26, 2019 4:00 PM
  • Hi (need code)

    I use crystal reports i want form , when i press print button, it print crystal report, instead of show data grid view values on report for print preview. 

    NOTE data grid view use database value

    thanks


    MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959


    Hi ,

    I think in this case you should feed us by the code you used for performing this mission in order to find solution to your issue ......


    Regards From Egypt


    • Edited by Amr_Aly Tuesday, March 26, 2019 6:05 PM
    Tuesday, March 26, 2019 4:27 PM
  • hi

    i want when i press PRINT button  my report go to printer for printing

    Imports System.Data
    Imports System.Data.SqlClient
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.CrystalReports
    
    Public Class Database_value_print
       
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim connection As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=TestA;Integrated Security=True")
            Dim adapter As New SqlDataAdapter("select * from table_1", connection)
            Dim table As New DataTable()
            adapter.Fill(table)
            DataGridView1.DataSource = table
        End Sub   
    
        Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
            Dim myreport As New Report
            CrystalReportViewer1.ReportSource = myreport
    
        End Sub
    End Class



    MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959

    Tuesday, March 26, 2019 7:07 PM
  • Imports System.Data
    Imports System.Data.SqlClient
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.CrystalReports
    
    Public Class Database_value_print
         Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim connection As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=TestA;Integrated Security=True")
            Dim adapter As New SqlDataAdapter("select * from table_1", connection)
            Dim table As New DataTable()
            adapter.Fill(table)
            DataGridView1.DataSource = table
        End Sub
    
        Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
            Dim myreport As New Report
            CrystalReportViewer1.ReportSource = myreport
    
        End Sub
    End Class


    MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959

    Tuesday, March 26, 2019 7:16 PM
  • I hope this link help you to solve your issue

    Print DGV

     Good luck

    Regards From Egypt

    Tuesday, March 26, 2019 7:35 PM
  • hi 

     it is a complex source code.  is it use for crystal report or not. 

    you have done good job.  i think it not work for crystal reports.  if you think, then find out the code which print crystal report. according to given picture


    MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959

    Tuesday, March 26, 2019 8:23 PM
  • Hi,

    If your issue is more related about crystal report,ask in the following forum:

    https://help.sap.com/bocr

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 28, 2019 1:28 AM