title: How to get data of datagridview in Crystal Report in C#
body: <p>I have a Window Form in C#. i want that when i click get report the exact data of datagridview also show in crystal report viewer.</p>
  
  <pre><code>            DataTable dt = new DataTable();
              DataSet ds = new DataSet();
  
              dt = dataGridView1.DataSource as DataTable;
  
              ds.Tables.Add(dt);
  
              CrystalReport2 cos = new CrystalReport2();
  
              cos.SetDataSource(ds);
  
              crystalReportViewer1.ReportSource = cos;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Kc6Va.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/6XqCp.png" alt="enter image description here"></p>