?? form1.frm
字號:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form1
Caption = "打印DBGrid表格里的數據"
ClientHeight = 4320
ClientLeft = 60
ClientTop = 345
ClientWidth = 8025
LinkTopic = "Form1"
ScaleHeight = 4320
ScaleWidth = 8025
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
Caption = "打印"
Height = 375
Left = 2430
TabIndex = 2
Top = 3735
Width = 2610
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 360
Left = 5310
TabIndex = 1
Top = 3765
Width = 2550
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "Form1.frx":0000
Height = 3495
Left = 285
OleObjectBlob = "Form1.frx":0014
TabIndex = 0
Top = 180
Width = 7530
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 270
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = -75
Visible = 0 'False
Width = 1350
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim db As Database
Dim tb As TableDef
Dim PrintString As String
Private Sub Command2_Click()
Dim I As Long, J As Long, K As Long
Dim PrintStr As String
For I = 0 To Data1.Recordset.RecordCount - 1
If K = DBGrid1.VisibleRows Then
DBGrid1.Scroll 0, DBGrid1.VisibleRows
K = 0
End If
For J = 0 To DBGrid1.Columns.Count - 1
PrintString = PrintString & DBGrid1.Columns(J).CellText(DBGrid1.RowBookmark(K)) & "/"
Next
Printer.Print PrintString
PrintString = ""
K = K + 1
DoEvents
Next
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\sj.mdb"
Data1.Connect = ";pwd=" & 111
Data1.RecordSource = "sy"
End Sub
Private Sub Command1_Click()
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -