I converted an old
VB 6 program to
VB 2008. What the program does is to read a database table and depending on data requirements, it is supposed to display the record like first name and last name on to the form. With
VB 6.0 I just used the print method currentx and currenty but with
VB 2008 I can't get them to print. I have searched around and saw CreateGraphics so I used it to replace the print statement from
VB 6.0. After doing this, I can only see a blank form and the records are not getting displayed.
Below is the original
VB 6.0 code.
Code:
Private Sub PrintHeading(strstring, intColumn, introw, fontsize)
frmPrintBenefits.Height = 15000
frmPrintBenefits.Width = 11500
frmPrintBenefits.CurrentX = intColumn
frmPrintBenefits.CurrentY = introw
frmPrintBenefits.fontsize = fontsize
frmPrintBenefits.FontBold = True
frmPrintBenefits.Print strstring
End Sub
Here is the code from VB 2008 after it was converted. I used drawstring to print or display the records on the form. I thought this would work but I am seeing a blank form.
Code:
Friend Class frmPrintBenefits
Inherits System.Windows.Forms.Form
Dim g As Graphics = Me.CreateGraphics
Dim strstring as String
Dim intColumn as Integer
Dim intRow as Integer
Dim fontsize as Double
Private Sub PrintHeading(ByRef strstring As String, ByRef intColumn AsInteger, ByRef introw AsInteger, ByRef fontsize As Integer)
Me.Height = VB6.TwipsToPixelsY(15000)
Me.Width = VB6.TwipsToPixelsX(11500)
Me.Font = VB6.FontChangeSize(Me.Font, fontsize)
Me.Font = VB6.FontChangeBold(Me.Font, True)
g.DrawString(strstring, Font, Brushes.Black, intColumn, introw)
End Sub
End Class
Am I using the wrong syntax?
Thanks,
Judy