Printing DataGrid in VB
faico
-
camile -
camile -
salam
I'm working on a VB-Access project and I want to print the content of a datagrid without the other controls present on the form. Additionally, the datagrid is not fully displayed and requires scrolling.
Is there a direct method to do this? If not, is there a trick to export the content of the datagrid to Ms Excel?
I'm working on a VB-Access project and I want to print the content of a datagrid without the other controls present on the form. Additionally, the datagrid is not fully displayed and requires scrolling.
Is there a direct method to do this? If not, is there a trick to export the content of the datagrid to Ms Excel?
5 answers
Hello, I am currently working on a project based on Visual Basic. The problem I am facing is as follows: I would like to print the data located just in the datagrid of the form. Thank you in advance for your help.
```vb
Private Sub CmdPrint_Click()
Dim RRow As Integer, RecCount as integer
reccount=adodc1.recordset.recordcount
printer.print ""
For RRow = 0 To 13 ' change this to suit your need
or reccount
DataGrid1.Row = RRow
printer.Print DataGrid1.Columns(0).Text, Space(1), DataGrid1.Columns(1).Text, Space(1), DataGrid1.Columns(2).Text '
Next
printer.enddoc
End Sub ```
Dim RRow As Integer, RecCount as integer
reccount=adodc1.recordset.recordcount
printer.print ""
For RRow = 0 To 13 ' change this to suit your need
or reccount
DataGrid1.Row = RRow
printer.Print DataGrid1.Columns(0).Text, Space(1), DataGrid1.Columns(1).Text, Space(1), DataGrid1.Columns(2).Text '
Next
printer.enddoc
End Sub ```
Hello, since I can't implement these methods, I'm wondering if one of you could help me transfer the data from my datagrid in VB6 to Word or PDF. Thank you.