I am here with given my one problem, is mentioned here below;
I am beginner to visual basic programming after qualified VB6. And I wish to have some more experience for this programming. Hence I need some procedure on codling's for direct printing procedures. This is under a trial basis. Now I need your help on the subject that is coding for direct printing. My problem is in my report structure the amount, rate are not placed correctly right justification. The codes I used 1-rptjustfyright in code procedure area and also I select1-Rightjustify in the txtItemAmt2.Text in text box properties. The out put of the said value are not set to Right justified. The coding I written which is as given below. Please.
' The following is my Direct printing codings under trial :
‘==============
Private Sub cmdPrint_Click()
Dim nP As Single
Dim nGt As Currency
cmdLast2_Click
txtNo2.Alignment = rptJustifyRight
txtItemAmt2.Alignment = rptJustifyRight
nP = Val(txtItemTot2.Text)
nGt = Format(txtGrandTots2.Text, "##,##0.00")
'to place a blank-line..Here spc(7) means a seven chareacter size is blank from paper most margin end.
Printer.Print
Printer.Print
Printer.Print Spc(7); "PAN :"; Tab(60); "Cash-Bill No:"; Spc(2); txtCustId3.Text
Printer.Print Spc(7); "Dt:"; txtDt.Text; Tab(55); "PHONE: 958181-227602"
Printer.Print
Printer.Print Spc(7); "SRI SHANTERI KAMAKSHI NILAYA, BETTAMAKKI, THIRTHAHALLI"
Printer.Print Spc(7); "Mr/Mrs.."; Spc(3); txtCustName2.Text;
Printer.Print
Printer.Print Spc(7); "-----------------------------------------------------------------------------------------------"
Printer.Print Spc(7); "S.No."; Tab(14); "Qtty"; Tab(22); "Particulars"; Tab(59); "Rate"; Tab(69); "Amount"
Printer.Print Spc(7); "-----------------------------------------------------------------------------------------------"
cmdFirst2_Click
'cmdFirst2_Click
If txtNo2.Text = "1" Then
txtNo2.Alignment = 1 - JustifyRight
Printer.Print Spc(7); Val(txtNo2.Text);
Printer.Print Tab(14); Format(txtQtty2.Text, "##,##0.000");
Printer.Print Tab(22); txtItName2.Text;
txtRate2.Alignment = 1 - JustifyRight
Printer.Print Tab(59); Format(txtRate2.Text, "##,#00.00");
txtItemAmt2.Alignment = 1 - JustifyRight
Printer.Print Tab(71); Format(txtItemAmt2.Text, "##,#00.00")
cmdNext2_Click '2nd...
txtNo2.Alignment = 1 - JustifyRight
Printer.Print Spc(7); Val(txtNo2.Text);
Printer.Print Tab(14); Format(txtQtty2.Text, "##,##0.000");
Printer.Print Tab(22); txtItName2.Text;
txtRate2.Alignment = 1 - JustifyRight
Printer.Print Tab(59); Format(txtRate2.Text, "##,#00.00");
txtItemAmt2.Alignment = 1 - JustifyRight
Printer.Print Tab(71); Format(txtItemAmt2.Text, "##,#00.00")
Do Until myset2.EOF Or myset2(1) = nP
cmdNext2_Click
txtNo2.Alignment = 1 - JustifyRight
Printer.Print Spc(7); Val(txtNo2.Text);
Printer.Print Tab(14); Format(txtQtty2.Text, "##,##0.000");
Printer.Print Tab(22); txtItName2.Text;
txtRate2.Alignment = 1 - JustifyRight
Printer.Print Tab(59); Format(txtRate2.Text, "##,#00.00");
txtItemAmt2.Alignment = 1 - JustifyRight
Printer.Print Tab(71); Format(txtItemAmt2.Text, "##,#00.00")
Loop
Else
MsgBox "The selection could not be reach", vbInformation
End If
Printer.Print Spc(7); "-----------------------------------------------------------------------------------------------"
cmdLast2_Click
Printer.Print Spc(7); "Total Items:"; Spc(2); txtItemTot2.Text; Tab(28); txtHamali.Text; "Hamali:"; Tab(42); txtMisc.Text; "Misc:"; Tab(60); "Gr.Tot:"; Spc(3); Format(txtGrandTots2.Text, "##,##0.00")
Printer.Print Spc(7); "-----------------------------------------------------------------------------------------------"
Printer.Print Spc(7); Tab(30); "THANKQ ..Visit again"
Printer. Print Spc(7); "E & O E"
Printer.NewPage ' to close the same page
Printer.EndDoc ' printer works end.
cmdLast2_Click
Disply_Data2
End Sub
‘============== Here closes Direct printing job codings:
Please sir.
With regards
Devadas Nayak H
My email: dhnayak@rocketmail.com