C
Carlo
Hi
I'm trying to print the items in a listbox with the code below but
when I click on print I get
"An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in system.windows.forms.dll
Additional information: Specified argument was out of the range of
valid values"
Firstly, what does the message mean and secondly what am I doing wrong
in the coding below. More importantly how do I fix it?
Thanks
Carlob1
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Dim max, n As Integer
max = lstTally.Items.Count
For n = 1 To max
e.Graphics.DrawString(lstTally.Items(n), New Font("arial",
40, FontStyle.Regular), Brushes.Black, 200, 200)
Next
End Sub
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuItem1.Click
PrintDocument1.Print()
txtInput.Focus()
txtInput.SelectAll()
End Sub
I'm trying to print the items in a listbox with the code below but
when I click on print I get
"An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in system.windows.forms.dll
Additional information: Specified argument was out of the range of
valid values"
Firstly, what does the message mean and secondly what am I doing wrong
in the coding below. More importantly how do I fix it?
Thanks
Carlob1
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Dim max, n As Integer
max = lstTally.Items.Count
For n = 1 To max
e.Graphics.DrawString(lstTally.Items(n), New Font("arial",
40, FontStyle.Regular), Brushes.Black, 200, 200)
Next
End Sub
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuItem1.Click
PrintDocument1.Print()
txtInput.Focus()
txtInput.SelectAll()
End Sub