我在2000下用的tdbgrid的打印浏览和打印均没有问题,为什么在 98下不能正常浏览,更不能打印呢 ?在线急等,回复给分!!!

解决方案 »

  1.   

    tdbgrid 6.0
    Private Sub PrintDg()
      Dim X As Printer
      For Each X In Printers
         If X.Orientation = vbPRORPortrait Then
            '设定为系统缺省打印机。
            Set Printer = X
            Exit For
         End If
      Next
    End SubPublic Function Prn(Index As Integer) As Boolean
      On Error GoTo Err_exit
      Prn = False
      If Index = -1 Then Exit Function
      If TDBGrid1.ApproxCount = 0 Then
        MsgBox "无数据可打印!", vbExclamation, tAppCtl.Caption
        Exit Function
      End If
      PrintDg
      With TDBGrid1.PrintInfo
          .Name = tAppCtl.Caption
          .PreviewCaption = "领用单"
          .RepeatColumnFooters = True
          .RepeatColumnHeaders = True
          .RepeatGridHeader = True
          .RepeatSplitHeaders = True
          .VariableRowHeight = True
          .PageHeader = "领用单号:" & Text1.Text & Space(18) & "领用日期:" & DTPicker1.Value & Space(12) & "领用部门:" & Combo1.Text & vbCrLf & vbCrLf & vbTab
          .PageHeaderFont.Size = 10
          .PageFooter = "领用人:" & Combo2.Text & Space(56) & "合计金额:" & LblSum.Caption
          Select Case Index
          Case 0
              .PageSetup
          Case 1
              .PrintPreview 0
          Case 2
              .PrintData 0
          End Select
      End With
      Prn = True
      Exit Function
    Err_exit:
      MsgBox vbCrLf & Err.Description, vbExclamation, tAppCtl.Caption
    End Function一个使用Tdbgrid 6.0的例子。是可以打印的。
    98、2000都没问题。