[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 140
  • Last Modified:

Printing the values of the controls in a from [with Printer object]

Hi,
I have a problem in printing the values of all the controls of a form ,in a printer.I have a list view control in the form.I want to print all the values in that list view control.
The problem is while looping through all the values in that control,I facing the allignement problem.The output is well - alligned ,while Iam printing in the debug window.But it is not alligned ,while printed on a paper.Iam using the Printer object for this.What can I do now? Is there any other solution ?

----My code is ----
'objList - list view
'Variable declarations trimmed here.
'Totally I have 7 column headers in the list view.

    For intCount = 1 To objLst.ListItems.Count
           If intCountHd = 1 Then
               strCol1 = Trim(objLst.ListItems(intCount).Text)
               intSpace = FindDiff(arrColLen(intCountHd), Len(strCol1))
               intSpace = intSpace + intConst
               intSpace1 = intSpace
           Else
                Select Case intCountHd
                    Case 5
                      strCol1 = Trim(objLst.ListItems(intCount).ListSubItems(intCountHd - 1).Text)
                      intSpace = FindDiff(arrColLen(intCountHd), Len(strCol1))
                      intSpace = intSpace + intConst
                      intSpace1 = intSpace
                    Case 2, 6
                      strCol2 = Trim(objLst.ListItems(intCount).ListSubItems(intCountHd - 1).Text)
                      intSpace = FindDiff(arrColLen(intCountHd - 1), Len(strCol1))
                      intSpace = intSpace + intConst
                      intSpace2 = intSpace
                    Case 3, 7
                      strCol3 = Trim(objLst.ListItems(intCount).ListSubItems(intCountHd - 1).Text)
                      intSpace = FindDiff(arrColLen(intCountHd - 1), Len(strCol2))
                      intSpace = intSpace + intConst
                      intSpace3 = intSpace
                    Case 4
                      strCol4 = Trim(objLst.ListItems(intCount).ListSubItems(intCountHd - 1).Text)
                      intSpace = FindDiff(arrColLen(intCountHd - 1), Len(strCol3))
                      intSpace = intSpace + intConst
                      intSpace4 = intSpace
                End Select
           End If
           
       Next
          Print #1, strCol1 & Space(intSpace2) & strCol2 & Space(intSpace3) & strCol3 & Space(intSpace4) & strCol4
          'Printer.Print strCol1; Chr(9); strCol2; Chr(9); strCol3; Chr(9); strCol4
          'Printer.Print strCol1, strCol2, strCol3, strCol4
    Next
 --------------------------------------
Before this ,I will be printing the column headers,each separated by a space of 10.

Thanx in Advance & Appreciations for Ur valuable suggestions.

0
ashok73
Asked:
ashok73
  • 2
1 Solution
 
MayaOneCommented:
Hi!

I think, you can set the font of the printer object to a
fixed width font (like arial) and that should resolve your problem
0
 
MayaOneCommented:
Uups my mistake!

In the last comment i wrongly say that arial was a fixed width font, well... it isn't. the most common fixed with font in the diferent versions of ms windows seems to be the Courier

sorry!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now