0

I need help on passing checked list view items into one message box. my current code outputs multiple message box with the name of the item, depends on the number of items checked. what i need is to output into a message box all the items checked in my list view. the items should be posted in multiple lines. is there any way i can do it. i hope you guys can help me.

so far this is my code

Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click


        Dim litem As ListViewItem
        Dim litems As ListView.CheckedListViewItemCollection
        litems = lstviewcandidate.CheckedItems
        For Each litem In litems

            'ListBox1.Items.Add(litem.Text)
            MsgBox(litem.Text, MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Search Results: 0")
        Next

    End Sub
2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by angel392004
0

this might work

Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
 
 
        Dim litem As ListViewItem
        Dim litems As ListView.CheckedListViewItemCollection
        litems = lstviewcandidate.CheckedItems
        Dim checkstring as String   
   
        For Each litem In litems
 
            checkstring &=litem.Text & vbCrLf 
        
        Next
     MsgBox(checkstring, MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Search Results: 0")

    End Sub

Edited by meffe: n/a

0

this might work

Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
 
 
        Dim litem As ListViewItem
        Dim litems As ListView.CheckedListViewItemCollection
        litems = lstviewcandidate.CheckedItems
        Dim checkstring as String   
   
        For Each litem In litems
 
            checkstring &=litem.Text & vbCrLf 
        
        Next
     MsgBox(checkstring, MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Search Results: 0")

    End Sub

Thank you very much. it works perfectly...
if it is not too much to ask, is there a way for me to design my own message box to make it look presentable, like doing it in separate form. the output is still the same. and btw, what is vbCrLf for? thanks in advance

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.