HaworthBantam
Programmer
Folks,
I've been looking at this for a while now and I appear to be going round in circles, so any help would be greatly received.
I'm looking to print records from a data table. My VB6 code is:
Public Sub PrintRecord()
Dim strMySQL As String
Dim dbTest As Database
Dim rsTest As Recordset
Dim lngPayID As Long
Dim strTitle As String
Dim strForename As String
Dim strSurname As String
Dim lngX As Long, lngY As Long
strMySQL = "SELECT * FROM tblStaffPayIDs"
Set dbTest = OpenDatabase("C:\BDApps\Test\Test.mdb")
Set rsTest = dbTest.OpenRecordset(strMySQL)
'X and Y coordinates are set in "twips" - 1440 twips per inch (approx).
lngY = 400 'Set the Y coordinate to zero - this sets the vertical position.
Printer.FontSize = 12 'Set the font size
Printer.CurrentX = 1440 'Set the horizontal position.
Printer.CurrentY = lngY 'Set the vertical position
Printer.Print "Pay ID" 'Print the "header".
Printer.CurrentX = 2880 'Set the horizontal position.
Printer.CurrentY = lngY 'Set the vertical position.
Printer.Print "Name" 'Print the "header"
Printer.FontSize = 10 'Set the font size for the data.
With rsTest
.MoveFirst
Do Until .EOF 'Cycle through the data to print each record.
lngY = lngY + 400 'Set the vertical position of the next record.
lngPayID = !PayID
strTitle = !Title
strForename = !Forename
strSurname = !Surname
Printer.CurrentX = 1440
Printer.CurrentY = lngY
Printer.Print lngPayID
Printer.CurrentX = 2880 'Set the horizontal position of the name data.
Printer.CurrentY = lngY
Printer.Print strTitle & " " & strForename & " " & strSurname
.MoveNext 'Move to the next record
Loop
End With
Printer.EndDoc 'Print the document.
End Sub
This is pretty straight forward in VB6. However, I cannot work out how to do the exact same thing using dot NET.
Can any kind soul put me on the right track.....?
Thanks.
I've been looking at this for a while now and I appear to be going round in circles, so any help would be greatly received.
I'm looking to print records from a data table. My VB6 code is:
Public Sub PrintRecord()
Dim strMySQL As String
Dim dbTest As Database
Dim rsTest As Recordset
Dim lngPayID As Long
Dim strTitle As String
Dim strForename As String
Dim strSurname As String
Dim lngX As Long, lngY As Long
strMySQL = "SELECT * FROM tblStaffPayIDs"
Set dbTest = OpenDatabase("C:\BDApps\Test\Test.mdb")
Set rsTest = dbTest.OpenRecordset(strMySQL)
'X and Y coordinates are set in "twips" - 1440 twips per inch (approx).
lngY = 400 'Set the Y coordinate to zero - this sets the vertical position.
Printer.FontSize = 12 'Set the font size
Printer.CurrentX = 1440 'Set the horizontal position.
Printer.CurrentY = lngY 'Set the vertical position
Printer.Print "Pay ID" 'Print the "header".
Printer.CurrentX = 2880 'Set the horizontal position.
Printer.CurrentY = lngY 'Set the vertical position.
Printer.Print "Name" 'Print the "header"
Printer.FontSize = 10 'Set the font size for the data.
With rsTest
.MoveFirst
Do Until .EOF 'Cycle through the data to print each record.
lngY = lngY + 400 'Set the vertical position of the next record.
lngPayID = !PayID
strTitle = !Title
strForename = !Forename
strSurname = !Surname
Printer.CurrentX = 1440
Printer.CurrentY = lngY
Printer.Print lngPayID
Printer.CurrentX = 2880 'Set the horizontal position of the name data.
Printer.CurrentY = lngY
Printer.Print strTitle & " " & strForename & " " & strSurname
.MoveNext 'Move to the next record
Loop
End With
Printer.EndDoc 'Print the document.
End Sub
This is pretty straight forward in VB6. However, I cannot work out how to do the exact same thing using dot NET.
Can any kind soul put me on the right track.....?
Thanks.