Printing gridview data - is it really that hard???
Hi All
I've found greatly appriciated help in these forums earlier, so now I am relying on you again.
I have a datagridview that collects data form a Linq Query, and it work fine. But I'd like to print the data that is displayed in the datagridview.
The datagridview is multipaged and a commandbutton which i'd like to print at table document with the data.
Can some one please, please, please help me.
Here is my code, this far(don't mind the names, they are in danish):
Imports System
Imports System.IO
Imports System.Printing
Imports System.Drawing.Printing
Imports System.Data.Linq
Imports System.Data.Linq.Mapping
Public Class SROListeFrm
Private Sub SROListeFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim db As New SRODataContext
Dim GrdVwFsp = From List In db.SROTOTALs _
Select List.PPC, List.STNAVN, List.TAVLE, List.KANAL, List.KKS, List.KLRÃKKE, List.KABEL _
Order By PPC
SRODataGrdVw.DataSource = GrdVwFsp
With SRODataGrdVw
.Columns("PPC").DisplayIndex = 0
.Columns("STNAVN").DisplayIndex = 1
.Columns("TAVLE").DisplayIndex = 2
.Columns("KKS").DisplayIndex = 3
.Columns("KLRÃKKE").DisplayIndex = 4
.Columns("KANAL").DisplayIndex = 5
.Columns("KABEL").DisplayIndex = 6
End With
End Sub
Private Sub btnPrintList_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintList.Click
End Sub
End Class
Kind regards
Tina Nielsen, Denmark
|