Results 1 to 2 of 2

Thread: [RESOLVED] Make sure an item has been selected in a listbox

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    55

    Resolved [RESOLVED] Make sure an item has been selected in a listbox

    Hi,
    How do I make sure that an item has been selected on a listbox? I've tried the following, but it doesn't seem to work.
    Code:
    If ListBox1.SelectedItems.Count < 0 Then
                MsgBox("Error")
            End If
    EDIT: I realised that I forgot the '=' sign.

  2. #2
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: [RESOLVED] Make sure an item has been selected in a listbox

    Another way to check if an item has been selected is to check the selected index. If the selected index is -1 it means no item has been selected

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