请问怎样打印我用DATAGRID显示的数据库记录
因为现在非常着急,所以最好给出详细代码,改改就能用。万分感激!
因为现在非常着急,所以最好给出详细代码,改改就能用。万分感激!
解决方案 »
- 各位各位,大家有什么好方法获取在线QQ号合和昵称?我用枚举托盘托标然后判断前三位,但是有小毛病!
- 请教一句代码的含义
- VB 开发手机短信专栏
- 请问怎样做补丁程序?
- 如何做“帮助文件”?谢谢!
- 谁有VB方面的论文(含程序源码)
- VB access 数据 曲线图 曲柄图 职棒图
- 50分!!十万火急!!毕业设计!用VB + SQL 2000,如何WORD 类型的OLE控件绑定到数据库上!!
- ------>如何在ACCESS的查询中调用其它带参数的查询
- 急!急!有关打印报表问题!高分请出高手!一定给高分!
- 请问如何用vb往oracle中存图像
- 我要把屏幕的某一区域读出来装到我程序的picture中该怎么?
Private Sub PrintDataGrid()
Dim lFC As Long
Dim I As Long, K As Long
Dim lRC As Long
Dim lStepX As Long
Dim lPos() As Long
lFC = Me.DataGrid1.Columns.Count
lRC = Me.Adodc1.Recordset.RecordCount
lStepX = 60
ReDim lPos(lFC - 1) As Long
Printer.Font.Bold = True
For I = 0 To lFC - 1
lPos(I) = Me.CurrentX
Printer.Print Me.DataGrid1.Columns(I).Caption;
Printer.CurrentX = Printer.CurrentX + lStepX
Next I
Printer.Font.Bold = False
For I = 0 To lRC - 1
Printer.Print vbCrLf
Printer.DataGrid1.Row = I
For K = 0 To lFC - 1
Printer.CurrentX = lPos(K)
Printer.DataGrid1.Col = K
Printer.Print Me.DataGrid1.Text;
Next K
Next I
End Sub
Private Sub PrintDataGrid(objDataGrid As DataGrid, objADO As Adodc)
Dim lFC As Long
Dim I As Long, K As Long
Dim lRC As Long
Dim lStepX As Long
Dim lPos() As Long
lFC = objDataGrid.Columns.Count
lRC = objADO.Recordset.RecordCount
lStepX = 60
ReDim lPos(lFC - 1) As Long
Printer.Font.Bold = True
For I = 0 To lFC - 1
lPos(I) = Me.CurrentX
Printer.Print objDataGrid.Columns(I).Caption;
Printer.CurrentX = Printer.CurrentX + lStepX
Next I
Printer.Font.Bold = False
For I = 0 To lRC - 1
Printer.Print vbCrLf
objDataGrid.Row = I
For K = 0 To lFC - 1
Printer.CurrentX = lPos(K)
objDataGrid.Col = K
Printer.Print objDataGrid.Text;
Next K
Next I
End Sub