Solved

Print an MSFlexGrid _and_ the form it's on

Posted on 2002-04-12
4
222 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

770 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