我尝试打印选定的索引项目,但我无法成功。打印选定的索引项目
你能帮我解决这个问题吗?
我在打印的页面上得到“-1”值。
Private Sub Textbox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
Dim idx As Integer = ListBox1.FindStringExact(TextBox2.Text)
If idx <> -1 Then
ListBox1.SelectedIndex = idx
ListBox2.Items.Add(ListBox1.Text)
ListBox1.Items.Remove(TextBox2.Text)
PrintDoc.Print()
End sub
Private Sub PrintDoc_PrintPage(ByVal sender As System.Object, ByVal e As Printing.PrintPageEventArgs) Handles PrintDoc.PrintPage
Dim drawfont As New Font("arial", 16)
Dim drawbrush As New SolidBrush(Color.Black)
e.Graphics.DrawString(ListBox1.SelectedIndex, drawfont, drawbrush, 100, 100)
End Sub
你得到任何错误?什么意思是“没有成功”? – hering
发生了什么事?应该发生什么?打印页面上的 –
打印值显示为“-1”。 – bpece