Solved

Print an MSFlexGrid _and_ the form it's on

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

Accepted Solution

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now