borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2016 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (How can print PDF file automatically?) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Bill Printing
Poster Message
karu
Level: Guest


icon Bill Printing

I am trying to print the bill for small glossary shop using following code.

Private Sub Command1_Click()
        Printer.NewPage
        Printer.Font.Name = "Courier New"
        Printer.Font.Size = 8
        
        Printer.Print Space(18) & "Title" & vbCrLf
        Printer.Print Space(18) & "helloo all" & vbCrLf
        ....
        ....
        .....
        Printer.Print String(55, "-") & vbCrLf
        Printer.Print vbCrLf & vbCrLf
        Printer.Print "### -------------------- ###"
        Printer.EndDoc
End Sub

I need to print a single bill at a time. Paper I am using is roll paper. This above code is printing a bill but after finshed with prinitng it is throwing out certain paper. Please help me. How to stop the printer to throw a page after printing job is over.
Printer I am using is Epson LX300.  Please help.


[Edited by karu on 14-09-2003 at 09:53 AM GMT]T]   

[Edited by karu on 23-09-2003 at 09:59 AM GMT]

[Edited by karu on 23-09-2003 at 10:00 AM GMT]

14-09-2003 at 09:51 AM
| Quote Reply
nirmal
Level: Guest

icon Re: Bill Printing

You only need to set papersize property of printer object according to height of your bill. Set papersize before you start writing printing code, this will solve your problem.

14-10-2003 at 01:26 PM
| Quote Reply
caloy
Level: Trainee

Registered: 15-03-2006
Posts: 3
icon Re: Bill Printing

am using DOS printing so it would print fast. im trying to print the contents of my flexgrid. i have used the .printpicture of flexgrid but it still eject some papers..

the code above  doesnt work with me... it still throws up some paper even after i have set the paper size... i cnat even set the font...

i have the code below...  maybe you could help the  novice....


        Open "LPT1" For Output As #1
        
        Print #1, ""
        Print #1, ""
        
        Print #1, Tab(7); resibo.Label1(0)
        Print #1, resibo.Label1(1)
        Print #1, ""
        Print #1, ""


            For i = 0 To w - 5
                Print #1, .TextMatrix(i, 1); Tab(5) _
                          ; Left(.TextMatrix(i, 2), 15), _
                          .TextMatrix(i, 3)
            Next i
            
            For i = i To w
                Print #1, .TextMatrix(i, 2), , _
                          .TextMatrix(i, 3)
            Next i
            
            Print #1, ""
            Print #1, ""
            Print #1, ""
            Print #1, ""
            
            Close #1

maybe if you could hel me modify it to format my receipt.

15-03-2006 at 08:50 AM
View Profile Send Email to User Show All Posts | Quote Reply
soumen
Level: Trainee

Registered: 08-08-2006
Posts: 1
icon Re: Bill Printing

It is throwing some paper because of page setting.
I think set the paper in such a manner that is better for the printing.If the printer has custom page setting then use the option.
If it not helping you please mail me.

____________________________
soumen

08-08-2006 at 04:13 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
senthil
Level: Trainee

Registered: 04-11-2006
Posts: 1
icon Re: Bill Printing

pls reply for problem in code

dos printing in vb in difference font size, how to use
chr$ - function ho to use

04-11-2006 at 03:23 PM
View Profile Send Email to User Show All Posts | Quote Reply
ssn
Level: Trainee

Registered: 07-04-2007
Posts: 1
icon Re: Bill Printing

I am using PRINT #1, to write text in a file and i m printing it using edit.com.  even i tried to send ESC command to set page length in lines.  even after that once the printing over it ejects the paper a lot.  My paper is a roll paper of 40 character width.  Please help me how to stop the ejection of paper. Once print over i want it to stop there itself.

07-04-2007 at 01:43 PM
View Profile Send Email to User Show All Posts | Quote Reply
gunpath
Level: Protégé

Registered: 17-09-2007
Posts: 4
icon Re: Bill Printing

Private Sub CashPrint()

Dim cPaid As String, cBbal As String
Dim nWgt As String, nQty As String, cTotwgt As String, cLess As String
Dim nLM As Integer, cVl As String, nBG As Integer, cHl As String
Dim nTotAmt As Double, nTotQty, nTRAmt As Double
Dim nTlen, nLoop, nInc As Integer, cString As String

nLM = 0
cVl = " "
cHl = "-"
Open "c:\files\testfile" For Output As #1  ' Open file for output.
For l = 1 To 4
Print #1, Chr(27) + "j" + "n"
Next
'############### Head Printing #################
       Print #1,
    Print #1, Space(nLM) + CPad(CboCaCr.Text, 40)
    
    Print #1, Space(nLM) + Space(1) + "No." + RPad(Left(Trim(txtBNo.Text), 6), 6) + Space(15) + "Date:" + txtBDt.Text
    If txtpartyname.Text <> "" Then
        Print #1, Space(nLM) + Chr$(27) + Chr$(71) + "M/s " + Trim(txtpartyname.Text) + Chr(27) + Chr$(72)
    Else
        Print #1, Space(nLM) + Chr$(27) + Chr$(71) + "M/s " + Trim(txtName.Text) + Chr(27) + Chr$(72)
    End If
    If TxtAdd1.Text <> "" Then Print #1, Space(nLM) + TxtAdd1.Text
    If TxtAdd2.Text <> "" Then Print #1, Space(nLM) + TxtAdd2.Text
    If txtadd3.Text <> "" Then Print #1, Space(nLM) + txtadd3.Text
'    Print #1, Space(nLM) + Space(1) + "Date:" + txtBDt.Text + Space(5) + "    Time:" + txtTime.Text
'############ End Of Head Printing #################


'############ Body  Printing #################
'    If TxtAdd4.Text <> "" Then Print #1, Space(nLM) + TxtAdd4.Text



'******///////////////////Credit Bill /////////////////////// Starts here
        
'        Print #1, Space(nLM) + cString
'        If i = 1 Then
'        nInc = nInc + 34
'        Else
'        nInc = nInc + 40
'        End If
'        Next
'        End If
'    End If
    
    Print #1, Space(nLM) + String(40, "=")
    Print #1, Space(nLM) + RPad("Rate", 7) + cVl + Chr(15) + CPad("Particulars  ", 30) + Chr(18) + LPad("Qty", 3) + Space(1) + Space(2) + LPad("Amount", 8)
    Print #1, Space(nLM) + String(40, "=")
    
    For i = 1 To flxgrd.Rows - 1
    If flxgrd.TextMatrix(i, 1) <> "" Then
        If Val(flxgrd.TextMatrix(i, 3)) <> 0 Then
'            If Len(Trim(flxgrd.TextMatrix(i, 1))) < 22 Then
                Print #1, Space(nLM) + LPad(Format(flxgrd.TextMatrix(i, 4), "###0.00"), 7) + cVl + Chr(15) + RPad(Left(Trim(flxgrd.TextMatrix(i, 2)), 30), 30) + Chr(18) + cVl + LPad(flxgrd.TextMatrix(i, 3), 3) + Space(1) + Space(1) + LPad(Format(flxgrd.TextMatrix(i, 5), "####0.00"), 8)
'           Else
  '              Print #1, Space(nLM) + RPad(flxgrd.TextMatrix(i, 0), 3) + cVl + Chr(15) + RPad(Left(flxgrd.TextMatrix(i, 1), 30), 30) + Chr(18) + cVl + LPad(flxgrd.TextMatrix(i, 2), 3) + Space(1) + Chr(15) + LPad(Format(flxgrd.TextMatrix(i, 3), "###0.00"), 7) + Chr(18) + Space(1) + LPad(Format(flxgrd.TextMatrix(i, 4), "####0.00"), 8)
    '            Print #1, Space(nLM) + Space(3) + cVl + Chr(15) + RPad(Mid(flxgrd.TextMatrix(i, 1), 22, Len(flxgrd.TextMatrix(i, 1))), 10) + Chr(18) + cVl
   '         End If
        End If
'        nTotAmt = nTotAmt + Val(flxgrd.TextMatrix(i, 5))
'       nTotQty = nTotQty + Val(flxgrd.TextMatrix(i, 3))
    End If
    Next
    
    
    Print #1, Space(nLM) + String(42, "-")
    Print #1, Space(nLM) + Space(2) + "Total    " + Space(8) + LPad(Format(lblTqty, "#####0"), 6) + Space(6) + LPad(Format(lblTamt, "#####0.00"), 9)
    If Val(txtdR.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "            Less  " + Chr(18) + Space(19) + LPad(Format(txtdR.Text, "####0.00"), 8)
    If cboTax.ListIndex = 0 Then
        If Val(txtTax.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "    Sales Tax @" + Format(nMTax, "#0.00") + Chr(18) + Space(19) + LPad(Format(txtTax.Text, "####0.00"), 8)
        If Val(txtAsc.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + " Add Sur Charge" + Format(nMaTax, "#0.00") + Chr(18) + Space(19) + LPad(Format(txtAsc.Text, "####0.00"), 8)

    ElseIf cboTax.ListIndex = 1 Then
        If Val(txtTax.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "    V.A.T     @" + Format(nMVat, "#0.00") + Str(cboTax.ItemData(ListIndex)) + Chr(18) + Space(19) + LPad(Format(txtTax.Text, "####0.00"), 8)
    End If
    If Val(txtTrns.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "Transport Charges " + Chr(18) + Space(19) + LPad(Format(txtTrns.Text, "####0.00"), 8)
    
    Print #1, Space(nLM) + Space(32) + String(8, "-")
    Print #1, Space(nLM) + Space(32) + Chr(27) + Chr(71) + LPad(Format(txtTot.Text, "####0.00"), 8) + Chr(27) + Chr(72)
    Print #1, Space(17) + "     Received :" + LPad(Format(txtAmtR.Text, "####0.00"), 8)
    Print #1, Space(nLM) + Space(32) + String(8, "-")
    Print #1, Space(17) + "     Balance  :" + LPad(Format(txtAmtB.Text, "####0.00"), 8)
    Print #1,
    Print #1,
    Print #1,
    Print #1, Chr(15) + cUser + Chr(18)
    Print #1,
    Print #1,

'//////////////// FOR CASH BILL PRINTING procedure ends here

For K = 1 To 11
Print #1,
Next
Close #1

Do While True
RetVal = Shell("C:\FILES\DOSPRINT.BAT", 0)
If MsgBox("Print Again", vbOKCancel) = vbCancel Then
Exit Do
End If
Loop

End Sub

17-09-2007 at 01:37 PM
View Profile Send Email to User Show All Posts | Quote Reply
Joni
Level: Trainee

Registered: 06-03-2009
Posts: 2
icon Re: Bill Printing

Hi guys,

i wanted to ask if there is anyone on this discussion board who has figured the bill printing mechanism in vb6. Can anyone happen to print from a flexgrid directly to a printer? I have seen Gunpath's code, whichis interseting, but i had a problem in figuring out some of the keywords (CPad, LPad, RPad)..can anyone be of any help pls...i thankyou in advance....

am waiting.....

06-03-2009 at 08:57 PM
View Profile Send Email to User Show All Posts | Quote Reply
Joni
Level: Trainee

Registered: 06-03-2009
Posts: 2
icon Re: Bill Printing

hello guys,

I have figured it out. I have successfully used the code above. I really thanks Gunpath for his code. If there is anyone who needs how i used it, u can write it here and i will post it for everyone to learn. Thanks again for all and for andreavb....

06-03-2009 at 10:51 PM
View Profile Send Email to User Show All Posts | Quote Reply
vbsoftwaresupport
Level: Trainee

Registered: 25-01-2010
Posts: 2
icon Re: Bill Printing

quote:
Joni wrote:
hello guys,

I have figured it out. I have successfully used the code above. I really thanks Gunpath for his code. If there is anyone who needs how i used it, u can write it here and i will post it for everyone to learn. Thanks again for all and for andreavb....





please help me !!!!!!!!!
how to connect this code in vb6.0 please send a brief idea about that......
28-01-2010 at 06:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
dsr
Level: Trainee

Registered: 25-04-2011
Posts: 2
icon Re: Bill Printing

quote:
gunpath wrote:
Private Sub CashPrint()

Dim cPaid As String, cBbal As String
Dim nWgt As String, nQty As String, cTotwgt As String, cLess As String
Dim nLM As Integer, cVl As String, nBG As Integer, cHl As String
Dim nTotAmt As Double, nTotQty, nTRAmt As Double
Dim nTlen, nLoop, nInc As Integer, cString As String

nLM = 0
cVl = " "
cHl = "-"
Open "c:\files\testfile" For Output As #1  ' Open file for output.
For l = 1 To 4
Print #1, Chr(27) + "j" + "n"
Next
'############### Head Printing #################
       Print #1,
    Print #1, Space(nLM) + CPad(CboCaCr.Text, 40)
    
    Print #1, Space(nLM) + Space(1) + "No." + RPad(Left(Trim(txtBNo.Text), 6), 6) + Space(15) + "Date:" + txtBDt.Text
    If txtpartyname.Text <> "" Then
        Print #1, Space(nLM) + Chr$(27) + Chr$(71) + "M/s " + Trim(txtpartyname.Text) + Chr(27) + Chr$(72)
    Else
        Print #1, Space(nLM) + Chr$(27) + Chr$(71) + "M/s " + Trim(txtName.Text) + Chr(27) + Chr$(72)
    End If
    If TxtAdd1.Text <> "" Then Print #1, Space(nLM) + TxtAdd1.Text
    If TxtAdd2.Text <> "" Then Print #1, Space(nLM) + TxtAdd2.Text
    If txtadd3.Text <> "" Then Print #1, Space(nLM) + txtadd3.Text
'    Print #1, Space(nLM) + Space(1) + "Date:" + txtBDt.Text + Space(5) + "    Time:" + txtTime.Text
'############ End Of Head Printing #################


'############ Body  Printing #################
'    If TxtAdd4.Text <> "" Then Print #1, Space(nLM) + TxtAdd4.Text



'******///////////////////Credit Bill /////////////////////// Starts here
        
'        Print #1, Space(nLM) + cString
'        If i = 1 Then
'        nInc = nInc + 34
'        Else
'        nInc = nInc + 40
'        End If
'        Next
'        End If
'    End If
    
    Print #1, Space(nLM) + String(40, "=")
    Print #1, Space(nLM) + RPad("Rate", 7) + cVl + Chr(15) + CPad("Particulars  ", 30) + Chr(18) + LPad("Qty", 3) + Space(1) + Space(2) + LPad("Amount", 8)
    Print #1, Space(nLM) + String(40, "=")
    
    For i = 1 To flxgrd.Rows - 1
    If flxgrd.TextMatrix(i, 1) <> "" Then
        If Val(flxgrd.TextMatrix(i, 3)) <> 0 Then
'            If Len(Trim(flxgrd.TextMatrix(i, 1))) < 22 Then
                Print #1, Space(nLM) + LPad(Format(flxgrd.TextMatrix(i, 4), "###0.00"), 7) + cVl + Chr(15) + RPad(Left(Trim(flxgrd.TextMatrix(i, 2)), 30), 30) + Chr(18) + cVl + LPad(flxgrd.TextMatrix(i, 3), 3) + Space(1) + Space(1) + LPad(Format(flxgrd.TextMatrix(i, 5), "####0.00"), 8)
'           Else
  '              Print #1, Space(nLM) + RPad(flxgrd.TextMatrix(i, 0), 3) + cVl + Chr(15) + RPad(Left(flxgrd.TextMatrix(i, 1), 30), 30) + Chr(18) + cVl + LPad(flxgrd.TextMatrix(i, 2), 3) + Space(1) + Chr(15) + LPad(Format(flxgrd.TextMatrix(i, 3), "###0.00"), 7) + Chr(18) + Space(1) + LPad(Format(flxgrd.TextMatrix(i, 4), "####0.00"), 8)
    '            Print #1, Space(nLM) + Space(3) + cVl + Chr(15) + RPad(Mid(flxgrd.TextMatrix(i, 1), 22, Len(flxgrd.TextMatrix(i, 1))), 10) + Chr(18) + cVl
   '         End If
        End If
'        nTotAmt = nTotAmt + Val(flxgrd.TextMatrix(i, 5))
'       nTotQty = nTotQty + Val(flxgrd.TextMatrix(i, 3))
    End If
    Next
    
    
    Print #1, Space(nLM) + String(42, "-")
    Print #1, Space(nLM) + Space(2) + "Total    " + Space(8) + LPad(Format(lblTqty, "#####0"), 6) + Space(6) + LPad(Format(lblTamt, "#####0.00"), 9)
    If Val(txtdR.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "            Less  " + Chr(18) + Space(19) + LPad(Format(txtdR.Text, "####0.00"), 8)
    If cboTax.ListIndex = 0 Then
        If Val(txtTax.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "    Sales Tax @" + Format(nMTax, "#0.00") + Chr(18) + Space(19) + LPad(Format(txtTax.Text, "####0.00"), 8)
        If Val(txtAsc.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + " Add Sur Charge" + Format(nMaTax, "#0.00") + Chr(18) + Space(19) + LPad(Format(txtAsc.Text, "####0.00"), 8)

    ElseIf cboTax.ListIndex = 1 Then
        If Val(txtTax.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "    V.A.T     @" + Format(nMVat, "#0.00") + Str(cboTax.ItemData(ListIndex)) + Chr(18) + Space(19) + LPad(Format(txtTax.Text, "####0.00"), 8)
    End If
    If Val(txtTrns.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "Transport Charges " + Chr(18) + Space(19) + LPad(Format(txtTrns.Text, "####0.00"), 8)
    
    Print #1, Space(nLM) + Space(32) + String(8, "-")
    Print #1, Space(nLM) + Space(32) + Chr(27) + Chr(71) + LPad(Format(txtTot.Text, "####0.00"), 8) + Chr(27) + Chr(72)
    Print #1, Space(17) + "     Received :" + LPad(Format(txtAmtR.Text, "####0.00"), 8)
    Print #1, Space(nLM) + Space(32) + String(8, "-")
    Print #1, Space(17) + "     Balance  :" + LPad(Format(txtAmtB.Text, "####0.00"), 8)
    Print #1,
    Print #1,
    Print #1,
    Print #1, Chr(15) + cUser + Chr(18)
    Print #1,
    Print #1,

'//////////////// FOR CASH BILL PRINTING procedure ends here

For K = 1 To 11
Print #1,
Next
Close #1

Do While True
RetVal = Shell("C:\FILES\DOSPRINT.BAT", 0)
If MsgBox("Print Again", vbOKCancel) = vbCancel Then
Exit Do
End If
Loop

End Sub





Can you please send the Vb.net code for the above one....I am struggling here
25-04-2011 at 05:18 AM
View Profile Send Email to User Show All Posts | Quote Reply
dsr
Level: Trainee

Registered: 25-04-2011
Posts: 2
icon Re: Bill Printing

Hi to All,
I want to do the same in web application using vb.net...

So please tell me how to write the above code in vb.net 2008....


Thanks in advance

25-04-2011 at 05:27 AM
View Profile Send Email to User Show All Posts | Quote Reply
collergeo
Level: Trainee

Registered: 19-09-2011
Posts: 1
icon Re: Bill Printing

I'm trying to print bills in dot matrix printer thru VB program. It's working fine. But my problem is after taking 1st page printing when I tear off the page, the printer is not rolling back the extra page ejected in time of tearing off. Can any one help to sort out this problem.

____________________________
online printing company

19-09-2011 at 09:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
accounts
Level: Trainee

Registered: 15-12-2011
Posts: 2
icon Re: Bill Printing

pl help us v r trying to print on a pre printed paper through excel....but the dot matrix printer is ejecting the whole paper(A4 type)....we want the printer to stop and start there r 3 cheques on a single sheet of paper...

15-12-2011 at 11:47 AM
View Profile Send Email to User Show All Posts | Quote Reply
accounts
Level: Trainee

Registered: 15-12-2011
Posts: 2
icon Re: Bill Printing

thank u gunpath u r gr8    pl. if u could help us with  printing in the same manner if the same printer is on share and we want the print out from 2 computers we want the printer to start and stop on the computer where it is locally attached and on the computer where it is shared..thaxns in advance

29-12-2011 at 07:02 AM
View Profile Send Email to User Show All Posts | Quote Reply
gunpath
Level: Protégé

Registered: 17-09-2007
Posts: 4
icon Re: Bill Printing

still u find problem in printing in network

30-03-2012 at 08:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
gunpath
Level: Protégé

Registered: 17-09-2007
Posts: 4
icon Re: Bill Printing

        Dim ltFile As System.IO.File
        Dim oWrite As System.IO.StreamWriter, id As Integer
        oWrite = File.CreateText("C:\FILES\TESTFILE.txt")
        oWrite.WriteLine("Receipt No :" + txtReceiptNo.Text + "                    Receipt date: " + dpCdt.Value)
        oWrite.WriteLine()
        oWrite.WriteLine("Registration heading :" + cboImrUniv.Text)
        oWrite.WriteLine()
        oWrite.WriteLine("In Favour of  : DR." + txtRecDrName.Text)
        oWrite.WriteLine()
        oWrite.WriteLine("Amount :" + txtAmount.Text)
        oWrite.WriteLine()
        oWrite.WriteLine("Amount in word:" + NumToWord(Val(txtAmount.Text)))
        For i = 0 To dgAddQuali.Rows.Count - 1
            If dgAddQuali.Item(1, i).Value <> "" Then
                oWrite.WriteLine(dgAddQuali.Item(1, i).Value + dgAddQuali.Item(2, i).Value + dgAddQuali.Item(3, i).Value + dgAddQuali.Item(4, i).Value + dgAddQuali.Item(5, i).Value)
            End If

        Next

        oWrite.Close()
        id = Shell("""c:\files\dosprint.bat""", AppWinStyle.Hide, True, 100000)

30-03-2012 at 01:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
gunpath
Level: Protégé

Registered: 17-09-2007
Posts: 4
icon Re: Bill Printing

DOSPRINT.BAT


type c:\files\testfile.txt > \\LG-PC\EpsonLX-800

THIS IS FOR NET WORK PRINTER

30-03-2012 at 01:13 PM
View Profile Send Email to User Show All Posts | Quote Reply
sheetal
Level: Trainee

Registered: 09-04-2012
Posts: 1
icon Issue in Printing

I have written the code for printing in 10by12 paper.Still my report is printed in 10by06 paper.I am using crystal report 11.0.I am printing it directly through coding in vb.net.I have checked printer settings.Everything is fine.I am placing my code below.Please help me in this regard on urgent basis.


Public Sub PrintBill(ByVal MyNewID As String)
        If sqlconn.State = ConnectionState.Closed Then
            sqlconn.Open()
        End If
        Try

            Dim strReportPath As String = Application.StartupPath & _
             "\" & "Reports\InvoicePrinting.rpt"

          
            cr.Load(strReportPath)
            If Not IO.File.Exists(strReportPath) Then
                Throw (New Exception("Unable to locate report file:" & _
                  vbCrLf & strReportPath))
            End If
            
            ReportName = "Invoice Printing"
            Dim strDate$ = ReportName & " for the Bill No " & TXT_BILL_NO.Text.ToString.Trim

          
            Dim cm As New SqlCommand("select * from dbo.VWRptBillPrinting where  BILL_NO='" & (lblLastInvoiceNo.Text) & "' And Fin_Id=" & fin_year, sqlconn, Tran)
            
            Dim DataSetFinal As New DataSet
            Dim adpt As New SqlDataAdapter(cm)
            adpt.Fill(DataSetFinal, "MyTable")
          
            Mytable = DataSetFinal.Tables(0)
            
            cr.SetDataSource(DataSetFinal.Tables("MyTable"))

        'Code for Sub Report
            Dim str(), server(), db(), uid(), pwd() As String
            str = Split(Fn_GetConnection("ConnStr"), ";")
            server = Split(str(0), "=")
            db = Split(str(1), "=")
            uid = Split(str(2), "=")
            pwd = Split(str(3), "=")
            ConInfo.ConnectionInfo.UserID = uid(1)
            ConInfo.ConnectionInfo.Password = pwd(1)
            ConInfo.ConnectionInfo.ServerName = server(1)
            ConInfo.ConnectionInfo.DatabaseName = db(1)
            Dim index, intCounter, intCounter1 As Integer
            For index = 0 To cr.Database.Tables.Count - 1
                cr.Database.Tables(index).ApplyLogOnInfo(ConInfo)
            Next
          
            'Code for Printing
            Dim myPrintOptions As PrintOptions = cr.PrintOptions
            Dim ObjPrinterSetting As New System.Drawing.Printing.PrinterSettings
            myPrintOptions.PrinterName = ObjPrinterSetting.PrinterName
            Dim PkSize As New System.Drawing.Printing.PaperSize
            Dim mPaperSize As String
      
            mPaperSize = "10By12Paper"
            For i = 0 To ObjPrinterSetting.PaperSizes.Count - 1
                If ObjPrinterSetting.PaperSizes.Item(i).PaperName.ToString.Trim.Equals(mPaperSize.Trim) Then
                    PkSize = ObjPrinterSetting.PaperSizes.Item(i)
                    Exit For
                End If
            Next
            myPrintOptions.PaperSize = CType(PkSize.RawKind, CrystalDecisions.Shared.PaperSize)
            cr.PrintOptions.PrinterName = ObjPrinterSetting.PrinterName
            cr.PrintOptions.PaperSize = CType(PkSize.RawKind, CrystalDecisions.Shared.PaperSize)
            cr.PrintToPrinter(1, False, 0, 0)
          
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Sales Module")
        End Try
    End Sub

____________________________
sheetal

09-04-2012 at 07:21 AM
View Profile Send Email to User Show All Posts | Quote Reply
imagetvr
Level: Trainee

Registered: 05-01-2015
Posts: 1
icon Re: Bill Printing

To gunpath.

1. How print file using your code in USB Dot Matrix Printer USB Dot Matrix

2. Is it possible to Increase font size / font style in your method ?

3. In Printer.print method how to stop printer without Ejecting paper ( In continuous Roll paper)

16-03-2016 at 01:01 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : Bill Printing
Next Topic (How can print PDF file automatically?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2016 Andrea Tincaniborder