Solved

Print an MSFlexGrid _and_ the form it's on

Posted on 2002-04-12
4
230 Views
Last Modified: 2010-05-02
Hello all
I have some forms that have text and up to two different MSFlexGrids on them.
If I use PrintForm the Grids are black on our HP laserjets.  If I use the old Printer.PaintPicture grdDisputes.Picture, 0, 0, the data in the Grids prints fine, but obviously that doesn't print anything else but the grid.
SO, the points are for the code to a function (which'll be called from the form itself) that prints the form and the Grid, with the Grid data visible, not blacked out.

Thanks

v
0
Comment
Question by:vlg
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 total points
ID: 6936986
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6936989
this is a duplicate question of http://www.experts-exchange.com/questions/Q.20288032.html.

please delete this one.
0
 
LVL 1

Expert Comment

by:surajdeo
ID: 6937032
hi,
 
 u can print using printer object, here i am giving one example, in which form is contaning textboxes, label datepicker and flexgrid and a button. if u r clicking print button all the data will be print.


Private Sub CmdPrint_Click()

       
        Printer.PaperSize = vbPRPSA4
        Printer.FontSize = 10
        Printer.FontBold = True
       
        Printer.CurrentX = 1000
        Printer.CurrentY = 1000
        Printer.Print "CustCode : " & VL_Int_CustCode

        Printer.CurrentY = 1000
        Printer.CurrentX = 4400
        Printer.Print "Date : " & dtpSalesDate.Value


        Printer.CurrentX = 1000
        Printer.CurrentY = 1500
        Printer.Print "BilNo : " & txtBilNo.Text


        Printer.CurrentX = 1000
        Printer.CurrentY = 2000
        Printer.Print "Patient : " & txtPatientName.Text

        Printer.CurrentY = 2000
        Printer.CurrentX = 4400
        Printer.Print "Pay Mode : " & cmbModeOfPay.Text


        Printer.CurrentX = 1000
        Printer.CurrentY = 2500
        Printer.Print "Doctor : " & txtDoctorName.Text

        Printer.CurrentY = 2500
        Printer.CurrentX = 4400
        Printer.Print "Sales Return : " & lblSReturn.Caption

                       
        Printer.CurrentX = 500
        Printer.CurrentY = 3200
       
        Dim i, cy, cx
        For i = 0 To MSFGSales.Rows - 1
            If i > 0 Then Printer.FontBold = False
           
            cy = Printer.CurrentY
            Printer.CurrentX = 1000
            Printer.Print MSFGSales.TextMatrix(i, 0)
           
            Printer.CurrentX = 1650
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 1)
           
            Printer.CurrentX = 2750
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 2)
           
            Printer.CurrentX = 5000 '4850
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 3)
           
            Printer.CurrentX = 6000 '5850
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 4)
           
            Printer.CurrentX = 7500 '7000
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 5)
           
            Printer.CurrentX = 8150 '7650
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 6)
           
            Printer.CurrentX = 9000 '8300
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 7)
            If i >= 0 Then Printer.CurrentY = Printer.CurrentY + 300
        Next i
       
        Printer.CurrentX = 5500
       
        cx = Printer.CurrentX
       
        Printer.CurrentX = cx
        Printer.CurrentY = Printer.CurrentY + 700
        Printer.Print "TotAmount : " & txtTotAmount.Text
       
        Printer.CurrentX = cx
        Printer.CurrentY = Printer.CurrentY + 400
        Printer.Print "SRD : " & txtSRD.Text
       
        Printer.CurrentX = cx
        Printer.CurrentY = Printer.CurrentY + 400
        Printer.Print "Amount to Pay : " & txtTMtPay.Text
       
        Printer.CurrentX = cx
        Printer.CurrentX = 700
        Printer.CurrentY = 10000
        Printer.Print "Page No : " & Printer.Page
        Printer.EndDoc
               
   
End Sub
0
 

Author Comment

by:vlg
ID: 6937363
It worked, although M$ should be ashamed of themselves if that's the best solution they can provide - but thanks for the prompt, relevant response - very much appreciated.

v
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question