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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.