Results 1 to 3 of 3

Thread: [RESOLVED] popup msgbox for no selected item in listbox

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] popup msgbox for no selected item in listbox

    How do I got the pop up when no item is selected in the listbox?

    Code:
    For i = 0 To ListBox1.ListCount - 1
            If ListBox1.Selected(i) = True Then
                SelectLayerByName (ListBox1.List(i))
            End If
        Next

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: popup msgbox for no selected item in listbox

    Try this:
    Code:
        SelectedCount = 0
        For i = 0 To ListBox1.ListCount - 1
            If ListBox1.Selected(i) = True Then
                SelectedCount = SelectedCount +1
                SelectLayerByName (ListBox1.List(i))
            End If
        Next
        If SelectedCount = 0 Then
            MsgBox "No Item Selected"
        End If
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: popup msgbox for no selected item in listbox

    Thank you so much.. It work now

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