简体   繁体   English

打印所选索引项

[英]Print selected index item

I try to print selected index item but I couldnt succeed. 我尝试打印选定的索引项,但我无法成功。

Could you please help me for fixing the codes? 你能帮我修理一下这些代码吗?

I get "-1" value on the printed page. 我在打印页面上得到“-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

http://watchmynewvideoxyz.blogspot.in/2017/02/user3900603-your-answer.html http://watchmynewvideoxyz.blogspot.in/2017/02/user3900603-your-answer.html

go there your code ready 去那里你的代码准备好了

if ok make me +1 如果确定让我+1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM