简体   繁体   English

打印表单 VB.net 中的所有标签

[英]Printing all Labels in a Form VB.net

I want to print all labels in a form我想以表格形式打印所有标签
how to do that?怎么做?

I have more the 12 labels in my form我的表单中有更多的 12 个标签

See this page for a breakdown on vb.net printing methods:有关 vb.net 打印方法的细分,请参阅此页面:

https://social.msdn.microsoft.com/Forums/en-US/72b5a038-912d-4455-929d-89eeb9984d7c/how-do-i-print-a-form-in-vbnet?forum=Vsexpressvb https://social.msdn.microsoft.com/Forums/en-US/72b5a038-912d-4455-929d-89eeb9984d7c/how-do-i-print-a-form-in-vbnet?forum=Vsexpressvb

To get the text out of all your labels, use this code:要从所有标签中获取文本,请使用以下代码:

For Each ctrl As Control In Me.Controls
    If TypeOf (ctrl) Is Label Then
        Dim newLine As String = ctrl.Name & ": " & ctrl.Text
        'Process newLine as you see fit
    End If
Next

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

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