J
Jasper Jones
I'm really stuck on this, I just can't seem to figure it out. In the
code below I read the item property of a Datagrid I have on my form.
However, I get an error about the datagrid1 part saying "Reference to a
non-shared member requires an object reference." How do I go about
creating a reference to my datagrid? I'd be eternally grateful to
anyone who can help me with this as I just can't seem to make any
progress with this.
Here's my code:
Public Class PrintStatement
Inherits PrintDocument
Protected Overrides Sub OnPrintPage(ByVal e As
PrintPageEventArgs)
MyBase.OnPrintPage(e)
Dim fnt As New Font("Courier New", 8, FontStyle.Regular,
GraphicsUnit.Point)
Dim LineX As Integer = 0
'loop through every row in the dataset
Dim iCtr As Integer
For iCtr = 0 To dsCashSale.Tables("dtCashSale").Rows.Count
- 1
e.Graphics.DrawString(Datagrid1.Item(iCtr, 1), fnt,
Brushes.Black, 20, LineX)
LineX = LineX + 12
Next
fnt.Dispose()
' Indicate that there are no more pages.
e.HasMorePages = False
End Sub
End Class
code below I read the item property of a Datagrid I have on my form.
However, I get an error about the datagrid1 part saying "Reference to a
non-shared member requires an object reference." How do I go about
creating a reference to my datagrid? I'd be eternally grateful to
anyone who can help me with this as I just can't seem to make any
progress with this.
Here's my code:
Public Class PrintStatement
Inherits PrintDocument
Protected Overrides Sub OnPrintPage(ByVal e As
PrintPageEventArgs)
MyBase.OnPrintPage(e)
Dim fnt As New Font("Courier New", 8, FontStyle.Regular,
GraphicsUnit.Point)
Dim LineX As Integer = 0
'loop through every row in the dataset
Dim iCtr As Integer
For iCtr = 0 To dsCashSale.Tables("dtCashSale").Rows.Count
- 1
e.Graphics.DrawString(Datagrid1.Item(iCtr, 1), fnt,
Brushes.Black, 20, LineX)
LineX = LineX + 12
Next
fnt.Dispose()
' Indicate that there are no more pages.
e.HasMorePages = False
End Sub
End Class