Results 1 to 3 of 3

Thread: For or Do statement for Listboxes in VB.NET [Resolved]

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2001
    Posts
    244

    For or Do statement for Listboxes in VB.NET [Resolved]

    I have a listbox (currently project is in VB.NET but could do in VB6. The listbox contains a list of items. What would the syntax be for a For or Do statement that would perform an action for each item that is checked\highlighted?
    IE. 6 names in a listbox, 3 are highlighted. What would the statement look like if I wanted a msgbox to pop-up for each of their names. Below is the syntax for VB6, I cannot figure out the syntax for VB.NET.

    VB Code:
    1. Dim n As Long, nCount As Long
    2. nCount = List1.ListCount - 1
    3. For n = 0 To nCount
    4.     If List1.Selected(n) Then
    5.         MsgBox List1.List(n)
    6.     End If
    7. Next
    Last edited by jlegan; Apr 21st, 2003 at 08:33 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width