Visual Basic' 15组合框文本到标签

时间:2017-04-25 00:58:12

标签: vb.net combobox

基本上,我希望能够将组合框中的所有文本项发送到不同表单上的标签进行打印。

这是我的代码段;

        '   Shows the yacht types in a new called frmYachtTypeSummary which then can be printed
    frmYachtTypeSummary.lblYachtTypeSummary.Text = cboYachtType.Text.ToString
    frmYachtTypeSummary.ShowDialog()

当我使用我在这里的内容时,如果我在组合框中选择一个对象,它将打印到所需的形式。我想做的是将整个组合框打印到表单中。

1 个答案:

答案 0 :(得分:0)

Dim allItems as String, item as Object
For Each item In cboYachtType.Items
    allItems = allItems & item.toString() & vbCrLf
Next
frmYachtTypeSummary.lblYachtTypeSummary.Text = allItems

p.s。:这个答案是作为VBA答案开始的,但似乎OP有标签错误。